Bootstrap Colors: Hex Codes, Classes and Full Palette (5.3)
Bootstrap 5 has eight theme colors (primary, secondary, success, info, warning, danger, light, and dark), built from a palette of ten base colors and nine grays, each with nine shades. This page is the reference: every color with its hex code, the classes that apply them, the CSS variables behind them, the subtle and emphasis variants added in 5.3, and the values Bootstrap switches to in dark mode. All values are from Bootstrap 5.3.9. To change the colors rather than look them up, see how to customize Bootstrap 5 colors.
Bootstrap theme colors
| Name | Hex | RGB | Text class | Background class | Based on |
|---|---|---|---|---|---|
| Primary | #0d6efd |
13, 110, 253 | text-primary |
bg-primary |
$blue |
| Secondary | #6c757d |
108, 117, 125 | text-secondary |
bg-secondary |
$gray-600 |
| Success | #198754 |
25, 135, 84 | text-success |
bg-success |
$green |
| Info | #0dcaf0 |
13, 202, 240 | text-info |
bg-info |
$cyan |
| Warning | #ffc107 |
255, 193, 7 | text-warning |
bg-warning |
$yellow |
| Danger | #dc3545 |
220, 53, 69 | text-danger |
bg-danger |
$red |
| Light | #f8f9fa |
248, 249, 250 | text-light |
bg-light |
$gray-100 |
| Dark | #212529 |
33, 37, 41 | text-dark |
bg-dark |
$gray-900 |
The page itself uses #212529 for text and #fff for the background, and links use the primary blue, #0d6efd.
The full Bootstrap color palette
Each base color has nine shades. The 500 shade is the base color, lower numbers are tints mixed with white, and higher numbers are shades mixed with black.
| Color | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 |
|---|---|---|---|---|---|---|---|---|---|
| Blue | #cfe2ff |
#9ec5fe |
#6ea8fe |
#3d8bfd |
#0d6efd |
#0a58ca |
#084298 |
#052c65 |
#031633 |
| Indigo | #e0cffc |
#c29ffa |
#a370f7 |
#8540f5 |
#6610f2 |
#520dc2 |
#3d0a91 |
#290661 |
#140330 |
| Purple | #e2d9f3 |
#c5b3e6 |
#a98eda |
#8c68cd |
#6f42c1 |
#59359a |
#432874 |
#2c1a4d |
#160d27 |
| Pink | #f7d6e6 |
#efadce |
#e685b5 |
#de5c9d |
#d63384 |
#ab296a |
#801f4f |
#561435 |
#2b0a1a |
| Red | #f8d7da |
#f1aeb5 |
#ea868f |
#e35d6a |
#dc3545 |
#b02a37 |
#842029 |
#58151c |
#2c0b0e |
| Orange | #ffe5d0 |
#fecba1 |
#feb272 |
#fd9843 |
#fd7e14 |
#ca6510 |
#984c0c |
#653208 |
#331904 |
| Yellow | #fff3cd |
#ffe69c |
#ffda6a |
#ffcd39 |
#ffc107 |
#cc9a06 |
#997404 |
#664d03 |
#332701 |
| Green | #d1e7dd |
#a3cfbb |
#75b798 |
#479f76 |
#198754 |
#146c43 |
#0f5132 |
#0a3622 |
#051b11 |
| Teal | #d2f4ea |
#a6e9d5 |
#79dfc1 |
#4dd4ac |
#20c997 |
#1aa179 |
#13795b |
#0d503c |
#06281e |
| Cyan | #cff4fc |
#9eeaf9 |
#6edff6 |
#3dd5f3 |
#0dcaf0 |
#0aa2c0 |
#087990 |
#055160 |
#032830 |
| Gray | #f8f9fa |
#e9ecef |
#dee2e6 |
#ced4da |
#adb5bd |
#6c757d |
#495057 |
#343a40 |
#212529 |
In Sass these are $blue-100 to $blue-900, $gray-100 to $gray-900, and so on. Bootstrap doesn’t generate classes for the shades, so bg-blue-200 doesn’t exist. The last section shows how to add one.
Bootstrap color classes
Every theme color works with the same set of classes. Swap primary for any other name:
<p class="text-primary">Blue text</p>
<div class="bg-primary text-white p-3">Blue background</div>
<div class="text-bg-primary p-3">Blue background, readable text picked for you</div>
<div class="border border-primary p-3">Blue border</div>
<a class="link-primary" href="#">Blue link</a>
<button class="btn btn-primary">Button</button>
<div class="alert alert-primary">Alert</div>
Use text-bg-* when you set a background: it picks white or black text by contrast, so text-bg-warning gets dark text on yellow while bg-warning alone keeps the body text color.
The neutral classes follow the page colors and switch automatically in dark mode:
| Class | Use |
|---|---|
text-body |
Default text color |
text-body-secondary |
Muted text (replaces text-muted) |
text-body-tertiary |
Even lighter text |
text-body-emphasis |
Strongest text color |
bg-body |
Page background |
bg-body-secondary |
Gray panel background, #e9ecef in light mode |
bg-body-tertiary |
Lighter gray background, #f8f9fa in light mode |
There are also text-white, text-black, bg-white, bg-black, and bg-transparent.
Subtle and emphasis colors
Bootstrap 5.3 added three variants of each theme color for softer UI such as callouts, tags, and status panels:
| Name | bg-*-subtle |
border-*-subtle |
text-*-emphasis |
|---|---|---|---|
| Primary | #cfe2ff |
#9ec5fe |
#052c65 |
| Secondary | #e2e3e5 |
#c4c8cb |
#2b2f32 |
| Success | #d1e7dd |
#a3cfbb |
#0a3622 |
| Info | #cff4fc |
#9eeaf9 |
#055160 |
| Warning | #fff3cd |
#ffe69c |
#664d03 |
| Danger | #f8d7da |
#f1aeb5 |
#58151c |
| Light | #fcfcfd |
#e9ecef |
#495057 |
| Dark | #ced4da |
#adb5bd |
#495057 |
Combine them for a soft panel:
<div class="p-3 bg-success-subtle border border-success-subtle text-success-emphasis rounded">
Your changes were saved.
</div>
Opacity
Background, text, and border colors accept an opacity class: 10, 25, 50, 75, or 100.
<div class="bg-primary bg-opacity-25 p-3">25% blue background</div>
<p class="text-danger text-opacity-75">75% red text</p>
<div class="border border-success border-opacity-50 p-3">Half-transparent border</div>
This works because the color classes use RGB variables, such as --bs-primary-rgb: 13, 110, 253, with an opacity variable you can change. The backgrounds guide covers background opacity, gradients, and images in more detail.
Bootstrap colors in dark mode
With data-bs-theme="dark", the theme colors stay the same, but the page and the subtle and emphasis colors change so they read well on a dark background:
| Variable | Light | Dark |
|---|---|---|
--bs-body-bg |
#fff |
#212529 |
--bs-body-color |
#212529 |
#dee2e6 |
--bs-link-color |
#0d6efd |
#6ea8fe |
--bs-primary-bg-subtle |
#cfe2ff |
#031633 |
--bs-primary-text-emphasis |
#052c65 |
#6ea8fe |
--bs-danger-bg-subtle |
#f8d7da |
#2c0b0e |
--bs-danger-text-emphasis |
#58151c |
#ea868f |
That’s why the subtle classes are the safe choice for UI that has to work in both modes. The dark mode guide covers the toggle and how to set your own dark colors.
Bootstrap color CSS variables
Bootstrap writes every color to :root, so you can use them in your own CSS:
.callout {
border-left: 4px solid var(--bs-primary);
background: var(--bs-primary-bg-subtle);
color: var(--bs-primary-text-emphasis);
}
.price { color: var(--bs-success); }
.overlay { background: rgba(var(--bs-dark-rgb), 0.6); }
The palette colors are there too, as --bs-blue, --bs-indigo, --bs-gray-600, and so on, but only the base color of each, not the 100 to 900 shades.
Use a palette shade as a class
To get classes such as bg-blue-100, add the shades you need to the utilities with Sass:
@import "bootstrap/scss/functions";
@import "bootstrap/scss/variables";
@import "bootstrap/scss/variables-dark";
@import "bootstrap/scss/maps";
@import "bootstrap/scss/mixins";
@import "bootstrap/scss/utilities";
$utilities: map-merge(
$utilities,
(
"background-color": map-merge(
map-get($utilities, "background-color"),
(
values: map-merge(
map-get(map-get($utilities, "background-color"), "values"),
("blue-100": $blue-100, "blue-200": $blue-200, "teal-100": $teal-100)
),
)
),
)
);
@import "bootstrap/scss/utilities/api";
This gives bg-blue-100, bg-blue-200, and bg-teal-100. Without Sass, a one-line class does the same job: .bg-blue-100 { background-color: #cfe2ff; }.
To change the colors themselves, for example to use your brand blue as primary, open the builder, pick new theme colors with a live preview, and export the Sass or CSS, or follow the color customization guide.
FAQ
What are the Bootstrap 5 colors?
Bootstrap 5 has eight theme colors: primary #0d6efd (blue), secondary #6c757d (gray), success #198754 (green), info #0dcaf0 (cyan), warning #ffc107 (yellow), danger #dc3545 (red), light #f8f9fa, and dark #212529. They come from a palette of ten base colors (blue, indigo, purple, pink, red, orange, yellow, green, teal, cyan) and nine grays.
What is the Bootstrap primary color hex code?
The default Bootstrap 5 primary color is #0d6efd, RGB 13, 110, 253. Bootstrap 4 used #007bff.
How do I use a Bootstrap color class?
Add text-{color} for text, bg-{color} for a background, or text-bg-{color} for a background with a readable text color, as in <div class="text-bg-success p-3">Saved</div>. Replace {color} with primary, secondary, success, info, warning, danger, light, or dark.
Does Bootstrap have classes for color shades like blue-100?
No. The shades exist as Sass variables, such as $blue-100, but Bootstrap generates no classes for them. Add them to the background-color or color utility with the utilities API, or write a small class of your own.
What replaced text-muted in Bootstrap 5.3?
Use text-body-secondary. text-muted still works but is deprecated, and text-body-secondary adapts to dark mode.
How do I change the Bootstrap primary color?
Set $primary in Sass before importing Bootstrap, or override --bs-primary and --bs-primary-rgb in CSS for the classes that read them. The color customization guide covers both ways, and the bootstrap.build builder does it visually.
Try it in the builder
Make these changes visually with a live preview, then export clean Bootstrap Sass or CSS.
Open the Builder