Color system

Overview

Custom color system - a set of CSS classes and SCSS variables that allow to change colors on-the-fly directly in markup by changing class name or use color tints and shades in SCSS code. Color system includes 11 color palettes: 6 contextual (primary, secondary, danger, success, warning and info) and 5 secondary colors. The system is fully controlled by variable maps in _variables-core.scss and is a part of Bootstrap core since version 3.0.

The color system is supported by almost all layout elements and components: sidebar, navbar, content panels, links, text, icons, alerts, dropdown menus, form components, tables, tabs, progress bars, buttons, notifications, popovers, tooltips, badges etc. The system consists of 11 color palettes, each palette includes 1 main color (e.g. .bg-danger) in both HEX and RGB formats, color classes also support alpha transparency that can be set via .bg-opacity-[0|10|20|25|50|75] classes. List fo colors can be easily extended by adding or removing properties in $theme-colors and $dark-theme-colors SASS maps in _variables-core.scss file.

Available color palettes:

  • Primary palette
  • Secondary palette
  • Danger palette
  • Success palette
  • Warning palette
  • Info palette
  • Pink palette
  • Purple palette
  • Indigo palette
  • Teal palette
  • Yellow palette

When you add a new color to $theme-colors or $dark-theme-colors SASS maps in _variables-core.scss file, template configuration automatically creates a CSS variable for this color in HEX and RGB format and adds it to the root level.

										
											// SCSS input
											$theme-colors: (
												"indigo-100": $indigo-100,
												...
											);

											// CSS output
											:root,
											[data-color-theme=light] {
												--indigo-100: #eff0f9;
												--indigo-100-rgb: 239,240,249;
												...
											}
										
									

Basic usage

Usage is very simple, all you need to do is to add one of the color CSS classes to the element. Limitless template includes a bunch of pages with demonstration of how color palette is used - in components, elements and layout parts. Depending on what part of element you want to change, available classes are (primary palette is an example):

Class Description
Background
.bg-primary Background color. Can be added to dropdown menus, sidebar, navbar, alerts, inputs, cards, selects etc. In certain cases requires .text-white class to inverse text color
Borders
.border-primary Border color. Any element that contains border. Can be used in combination with .border class that adds a border to an element
border-top-primary Top border only. Any element that contains all sides border or top border only. Can be used in combination with .border-top class that adds a top border to an element
border-bottom-primary Bottom border only. Any element that contains all sides border or bottom border only. Can be used in combination with .border-bottom class that adds a bottom border to an element
border-start-primary Left border only. Any element that contains all sides border or left border only. Can be used in combination with .border-start class that adds a left border to an element
border-end-primary Right border only. Any element that contains all sides border or right border only. Can be used in combination with .border-end class that adds a right border to an element
Text
.text-primary Text color. Can be used in text, icons and links
.link-primary Text link color. Used in links only
Buttons
.btn-primary Solid button color
.btn-outline-primary Outline button color
.btn-flat-primary Flat button color
Alerts
.alert-primary Alert color. Can be used in all alert style variations
Table
.table-primary Table cell/row color
List group
.list-group-item-primary Text and links in link group

Colors

Color system uses custom color palette generated from 1 primary color (e.g. $blue-500) using SASS color functions: tint-color() for lighter color and shade-color() for lighter colors. Lightness and darkness step varies from 20% to 30%. Colored blocks below demonstrate all color codes and variables used in the template:

100 $blue-100
200 $blue-200
300 $blue-300
400 $blue-400
500 $blue-500
600 $blue-600
700 $blue-700
800 $blue-800
900 $blue-900
Primary (blue) palette
100 $slate-100
200 $slate-200
300 $slate-300
400 $slate-400
500 $slate-500
600 $slate-600
700 $slate-700
800 $slate-800
900 $slate-900
Secondary (slate) palette
100 $red-100
200 $red-200
300 $red-300
400 $red-400
500 $red-500
600 $red-600
700 $red-700
800 $red-800
900 $red-900
Danger (red) palette
100 $green-100
200 $green-200
300 $green-300
400 $green-400
500 $green-500
600 $green-600
700 $green-700
800 $green-800
900 $green-900
Success (green) palette
100 $orange-100
200 $orange-200
300 $orange-300
400 $orange-400
500 $orange-500
600 $orange-600
700 $orange-700
800 $orange-800
900 $orange-900
Warning (orange) palette
100 $cyan-100
200 $cyan-200
300 $cyan-300
400 $cyan-400
500 $cyan-500
600 $cyan-600
700 $cyan-700
800 $cyan-800
900 $cyan-900
Info (cyan) palette
100 $pink-100
200 $pink-200
300 $pink-300
400 $pink-400
500 $pink-500
600 $pink-600
700 $pink-700
800 $pink-800
900 $pink-900
Pink palette
100 $purple-100
200 $purple-200
300 $purple-300
400 $purple-400
500 $purple-500
600 $purple-600
700 $purple-700
800 $purple-800
900 $purple-900
Purple palette
100 $indigo-100
200 $indigo-200
300 $indigo-300
400 $indigo-400
500 $indigo-500
600 $indigo-600
700 $indigo-700
800 $indigo-800
900 $indigo-900
Indigo palette
100 $teal-100
200 $teal-200
300 $teal-300
400 $teal-400
500 $teal-500
600 $teal-600
700 $teal-700
800 $teal-800
900 $teal-900
Teal palette
100 $yellow-100
200 $yellow-200
300 $yellow-300
400 $yellow-400
500 $yellow-500
600 $yellow-600
700 $yellow-700
800 $yellow-800
900 $yellow-900
Yellow palette
100 $gray-100
200 $gray-200
300 $gray-300
400 $gray-400
500 $gray-500
600 $gray-600
700 $gray-700
800 $gray-800
900 $gray-900
Gray palette

SCSS and CSS

In version 3.0 color system is embedded in the core scss and no longer has separate files: _colors.scss and _palette.scss. Now all color variables are located in _variables-core.scss file in each layout and theme.

The code contains a set of 9 variables per each color and each color shade is generated dynamically from 1 main color HEX value. This means if you want to change e.g. primary color, you need to update only 1 variable and re-compile SCSS files, the system will generate all additional colors on-the-fly. You can find all color variables in _variables-core.scss file. This is how it works:

										
											// Define primary colors in HEX format
											$blue:    #0c83ff;
											$indigo:  #5C6BC0;
											$purple:  #8e70c1;
											$pink:    #f35c86;
											$red:     #EF4444;
											$orange:  #f58646;
											$yellow:  #ffd648;
											$green:   #059669;
											$teal:    #26A69A;
											$cyan:    #049aad;
											$slate:   #247297;

											// Blue color palette
											$blue-100: tint-color($blue, 90%);
											$blue-200: tint-color($blue, 60%);
											$blue-300: tint-color($blue, 40%);
											$blue-400: tint-color($blue, 20%);
											$blue-500: $blue;
											$blue-600: shade-color($blue, 20%);
											$blue-700: shade-color($blue, 40%);
											$blue-800: shade-color($blue, 60%);
											$blue-900: shade-color($blue, 90%);

											// Indigo color palette
											$indigo-100: tint-color($indigo, 90%);
											$indigo-200: tint-color($indigo, 60%);
											$indigo-300: tint-color($indigo, 40%);
											$indigo-400: tint-color($indigo, 20%);
											$indigo-500: $indigo;
											$indigo-600: shade-color($indigo, 20%);
											$indigo-700: shade-color($indigo, 40%);
											$indigo-800: shade-color($indigo, 60%);
											$indigo-900: shade-color($indigo, 90%);

											[...]


											// Light theme colors
											$theme-colors: (
											    "indigo":     $indigo,
											    "purple":     $purple,
											    "pink":       $pink,
											    "teal":       $teal,
											    "yellow":     $yellow,
											    "primary":    $primary,
											    "secondary":  $secondary,
											    "success":    $success,
											    "info":       $info,
											    "warning":    $warning,
											    "danger":     $danger,
											    "light":      $light,
											    "dark":       $dark,
											    "black":      $black,
											    "white":      $white
											);

											// Dark theme colors
											$dark-theme-colors: (
											  "indigo":     $indigo-300,
											  "purple":     $purple-300,
											  "pink":       $pink-300,
											  "teal":     $teal-300,
											  "yellow":     $yellow-300,
											  "primary":    $blue-300,
											  "secondary":  $slate-300,
											  "success":    $green-300,
											  "info":       $cyan-300,
											  "warning":    $orange-300,
											  "danger":     $red-300,
											  "light":      $gray-500,
											  "dark":       $gray-100
											);

										
									

As you can see in this example, property is a color class name and value is a color variable. If you add a new line to $theme-colors maps with "teal-400": $teal-400 values, the system will generate a set of classes with *-400 suffix: .bg-teal-400, .alert-teal-400, .text-teal-400, .link-teal-400, .btn-teal-400 etc. Same logic works the other way around as well. It will also generate a set of global CSS variables with the same name.

Please note - solid background colors now require combination with text color utility classes, e.g.<div class="bg-primary text-white"> or <div class="bg-primary bg-opacity-10 text-primary">.