Theme Colors
Bootstrap has a built-in set of named colors. Each color has a meaning, which makes your design consistent.
| Name | Typical Meaning |
primary | Main action or brand color (blue) |
secondary | Less important, supporting (gray) |
success | Positive or completed (green) |
danger | Error or delete (red) |
warning | Be careful (yellow) |
info | Information (light blue) |
light | Light gray or white |
dark | Almost black |
Text Colors
html
<p class="text-primary">Primary text</p>
<p class="text-success">Success text</p>
<p class="text-danger">Danger text</p>
<p class="text-warning">Warning text</p>
<p class="text-body-secondary">Muted text</p>
<p class="text-white bg-dark">White text on dark</p>
Background Colors
html
<div class="p-3 bg-primary text-white">Primary background</div>
<div class="p-3 bg-success text-white">Success background</div>
<div class="p-3 bg-light">Light background</div>
The text-bg Helper
Picking a readable text color for each background is easy to forget. The text-bg-* class sets both the background and a matching text color together.
html
<div class="p-3 text-bg-primary">Primary with the right text color</div>
<div class="p-3 text-bg-warning">Warning with dark text</div>
Subtle Colors
Soft versions of the theme colors are perfect for calm backgrounds, notices and cards.
html
<div class="p-3 bg-success-subtle text-success-emphasis">
A soft green message
</div>
<div class="p-3 bg-danger-subtle border border-danger-subtle">
A soft red message
</div>
Opacity
html
<div class="bg-primary bg-opacity-25 p-3">25% blue</div>
<div class="bg-primary bg-opacity-50 p-3">50% blue</div>
<div class="text-primary text-opacity-50">Half-transparent text</div>
Gradient
html
<div class="bg-primary bg-gradient text-white p-4">
Primary with a soft gradient
</div>
Link Colors
html
<a href="#" class="link-primary">Primary link</a>
<a href="#" class="link-danger">Danger link</a>
Accessibility tip: Always keep good contrast between text and background. Dark text on a light yellow bg-warning is readable, but white text on yellow is not.
Result
Colored text lines, solid and soft colored blocks, and one block with a gradient shine.
Conclusion
Bootstrap colors help you build a consistent, professional palette. Choose colors by meaning and use subtle variants for a modern, gentle look.
Quick Summary: text-*, bg-*, text-bg-*, *-subtle, bg-opacity-* and bg-gradient style your colors without writing CSS.