Open In App

How Many Colors available in Bootstrap 4 ?

Bootstrap 4 supports 10 different color utility classes that can be used for text and background colors. Each of these colors has a name that can be used to describe the use of colors on a page.

Color Utility Text Classes: These classes are used for changing the color of the text.



Example: This example shows the use of all the color utility classes for coloring text on the page.




<html>
<head>
    <link rel="stylesheet"
          href=
</head>
<body>
  <div class="p-3">
    <p class="text-primary">
      Welcome to geeksforgeeks
    </p>
  
    <p class="text-secondary">
      Welcome to geeksforgeeks
    </p>
  
    <p class="text-warning">
      Welcome to geeksforgeeks
    </p>
  
    <p class="text-success">
      Welcome to geeksforgeeks
    </p>
  
    <p class="text-danger">
      Welcome to geeksforgeeks
    </p>
  
    <p class="text-muted">
      Welcome to geeksforgeeks
    </p>
  
    <p class="text-dark">
      Welcome to geeksforgeeks
    </p>
  
    <p class="text-light">
      Welcome to geeksforgeeks
    </p>
  
    <p class="text-info">
      Welcome to geeksforgeeks
    </p>
  
    <p class="text-white">
      Welcome to geeksforgeeks
    </p>
  
  </div>
   <script src=
   </script>
  <script src=
  </script>
  <script src=
  </script>
</body>
</html>

Output: 



Color Utility Background Classes: These classes are used for changing the color of the background. When trying to use color utility classes for background, ‘text’ is replaced with ‘bg’ which stands for ‘background’.

The color utility classes for background colors are:

Example: This example shows the use of all the color utility classes for coloring the backgrounds on the page.




<html>
<head>
    <link rel="stylesheet"
          href=
</head>
<body>
  <div class="p-3">
    <div class="bg-primary m-2 p-2">
        Welcome to geeksforgeeks
    </div>
    <div class="bg-secondary m-2 p-2">
        Welcome to geeksforgeeks
    </div>
    <div class="bg-warning m-2 p-2">
        Welcome to geeksforgeeks
    </div>
    <div class="bg-success m-2 p-2">
        Welcome to geeksforgeeks
    </div>
    <div class="bg-danger m-2 p-2">
        Welcome to geeksforgeeks
    </div>
    <div class="bg-muted m-2 p-2">
        Welcome to geeksforgeeks
    </div>
    <div class="bg-dark m-2 p-2">
        Welcome to geeksforgeeks
    </div>
    <div class="bg-light m-2 p-2">
        Welcome to geeksforgeeks
    </div>
    <div class="bg-info m-2 p-2">
        Welcome to geeksforgeeks
    </div>
    <div class="bg-white m-2 p-2">
        Welcome to geeksforgeeks
    </div>
  </div>
   <script src=
   </script>
  <script src=
  </script>
  <script src=
  </script>
</body>
</html>

Output:


Article Tags :