Open In App

React.js Blueprint Colors Gray scale

Last Updated : 24 Aug, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

BlueprintJS is a React-based UI toolkit for the web. This library is very optimized and popular for building interfaces that are complex data-dense for desktop applications. Colors are important for styling the web page. Grayscale colors are different shades of gray color available to design web pages.

Gray scale colors:

  • Light-Gray: These are available in 5 different shades. (light-gray 1-5)
  • Gray: These are available in 5 different shades. (gray 1-5)
  • Dark-Gray: These are available in 5 different shades. (dark-gray 1-5)

Approach: Let us create a React project and install React Blueprint module. Then we will create a UI that will showcase React.js BluePrint Colors Grayscale.

Creating React Project:

Step 1: To create a react app, you need to install react modules through npx command. “npx” is used instead of “npm” because you will be needing this command in your app’s lifecycle only once.

npx create-react-app project_name

Step 2: After creating your react project, move into the folder to perform different operations.

cd project_name

Step 3: After creating the ReactJS application, Install the required module using the following command:

npm install @blueprintjs/core

Project Structure: After running the commands mentioned in the above steps, if you open the project in an editor you can see a similar project structure as shown below. The new component user makes or the code changes, we will be performing will be done in the source folder. 

Project Structure

Step to Run Application: Run the application using the following command from the root directory of the project:

npm start

Example 1: Below is the basic example code that illustrates the use of different React.js BluePrint Colors Grayscale.

App.js




import React from "react";
import "@blueprintjs/core/lib/css/blueprint.css";
  
export default function App() {
    const mystyle = {
        height:50,
        width:150,
        display:"flex",
        justifyContent:"center",
        alignItems:"center"
      };
        
    return (
        <div style={{ margin: 100}}>
            <h1 style={{ color: "green" }}>
              GeeksforGeeks
            </h1>
  
            <h3>React.js BluePrint Colors Gray scale</h3>
            <div style={{display:"flex"}}>
              <div style={{...mystyle,backgroundColor:"#D3D8DE"}}> 
                Light - Gray 1
              </div>
  
              <div style={{...mystyle,backgroundColor:"#DCE0E5"}}> 
                Light - Gray 2
              </div>
  
              <div style={{...mystyle,backgroundColor:"#E5E8EB"}}> 
                Light - Gray 3
              </div>
  
              <div style={{...mystyle,backgroundColor:"#EDEFF2"}}> 
                Light - Gray 4
              </div>
  
              <div style={{...mystyle,backgroundColor:"#F6F7F9"}}> 
                Light - Gray 5
              </div>
            </div>
            <br /> 
              
            <div style={{display:"flex",color:"#FFFFFF"}}>
              <div style={{...mystyle,backgroundColor:"#5F6B7C"}}> 
                Gray 1
              </div>
  
              <div style={{...mystyle,backgroundColor:"#738091"}}> 
                Gray 2
              </div>
  
              <div style={{...mystyle,backgroundColor:"#8F99A8"}}> 
                Gray 3
              </div>
  
              <div style={{...mystyle,backgroundColor:"#ABB3BF"}}> 
                Gray 4
              </div>
  
              <div style={{...mystyle,backgroundColor:"#C5CBD3"}}> 
                Gray 5
              </div>
            </div>
            <br />
  
            <div style={{display:"flex",color:"#FFFFFF"}}>
              <div style={{...mystyle,backgroundColor:"#1C2127"}}> 
                Dark - Gray 1
              </div>
  
              <div style={{...mystyle,backgroundColor:"#252A31"}}> 
                Dark - Gray 2
              </div>
  
              <div style={{...mystyle,backgroundColor:"#2F343C"}}> 
                Dark - Gray 3
              </div>
  
              <div style={{...mystyle,backgroundColor:"#383E47"}}> 
                Dark - Gray 4
              </div>
  
              <div style={{...mystyle,backgroundColor:"#404854"}}> 
                Dark - Gray 5
              </div>
            </div>
        </div>
    );
}


Output: Now open your browser and go to http://localhost:3000/, you will see the following output:

 

Example 2: Below is another example code that illustrates the use of React.js Typography Headings in Colors Gray scale.

App.js




import React from 'react'
import '@blueprintjs/core/lib/css/blueprint.css';
  
export default function App() {
    return (
      <div style={{ margin: 100 }}>
        <h1 style={{ color: 'green' }}>GeeksforGeeks</h1>
        <h3>React.js BluePrint Colors Gray scale</h3>
        <br/>
          
        <div>
          <h2 class="bp4-heading" style={{color:"#1C2127"}}>
            Geeks for Geeks 
          </h2>
  
          <h3 class="bp4-heading" style={{color:"#252A31"}}>
            Geeks for Geeks
          </h3>
  
          <h4 class="bp4-heading" style={{color:"#2F343C"}}>
            Geeks for Geeks
          </h4>
  
          <h5 class="bp4-heading" style={{color:"#383E47"}}>
            Geeks for Geeks
          </h5>
  
          <h6 class="bp4-heading" style={{color:"#404854"}}>
            Geeks for Geeks
          </h6>
        </div>
      </div>
    );
}


Output: Now open your browser and go to http://localhost:3000/, you will see the following output:

 

Reference: https://blueprintjs.com/docs/#core/colors.gray-scale



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads