Colors · Bootstrap V5.0
Maybe your like
v5 releases
- Latest (5.2.x)
- v5.1.3
- v5.0.2
- v4.6.x
- v3.4.1
- v2.3.2
- All versions
- Getting started
- Introduction
- Download
- Contents
- Browsers & devices
- JavaScript
- Build tools
- Webpack
- Parcel
- Accessibility
- RFS
- RTL
- Customize
- Overview
- Sass
- Options
- Color
- Components
- CSS variables
- Optimize
- Layout
- Breakpoints
- Containers
- Grid
- Columns
- Gutters
- Utilities
- Z-index
- Content
- Reboot
- Typography
- Images
- Tables
- Figures
- Forms
- Overview
- Form control
- Select
- Checks & radios
- Range
- Input group
- Floating labels
- Layout
- Validation
- Components
- Accordion
- Alerts
- Badge
- Breadcrumb
- Buttons
- Button group
- Card
- Carousel
- Close button
- Collapse
- Dropdowns
- List group
- Modal
- Navs & tabs
- Navbar
- Offcanvas
- Pagination
- Popovers
- Progress
- Scrollspy
- Spinners
- Toasts
- Tooltips
- Helpers
- Clearfix
- Colored links
- Ratio
- Position
- Visually hidden
- Stretched link
- Text truncation
- Utilities
- API
- Background
- Borders
- Colors
- Display
- Flex
- Float
- Interactions
- Overflow
- Position
- Shadows
- Sizing
- Spacing
- Text
- Vertical align
- Visibility
- Extend
- Approach
- Icons
- About
- Overview
- Team
- Brand
- License
- Translations
- Migration
Convey meaning through color with a handful of color utility classes. Includes support for styling links with hover states, too.
On this page- Colors
- Specificity
- Sass
- Variables
- Map
- Utilities API
Colors
Colorize text with color utilities. If you want to colorize links, you can use the .link-* helper classes which have :hover and :focus states.
.text-primary
.text-secondary
.text-success
.text-danger
.text-warning
.text-info
.text-light
.text-dark
.text-body
.text-muted
.text-white
.text-black-50
.text-white-50
<p class="text-primary">.text-primary</p> <p class="text-secondary">.text-secondary</p> <p class="text-success">.text-success</p> <p class="text-danger">.text-danger</p> <p class="text-warning bg-dark">.text-warning</p> <p class="text-info bg-dark">.text-info</p> <p class="text-light bg-dark">.text-light</p> <p class="text-dark">.text-dark</p> <p class="text-body">.text-body</p> <p class="text-muted">.text-muted</p> <p class="text-white bg-dark">.text-white</p> <p class="text-black-50">.text-black-50</p> <p class="text-white-50 bg-dark">.text-white-50</p>Conveying meaning to assistive technologies
Using color to add meaning only provides a visual indication, which will not be conveyed to users of assistive technologies – such as screen readers. Ensure that information denoted by the color is either obvious from the content itself (e.g. the visible text), or is included through alternative means, such as additional text hidden with the .visually-hidden class.
Specificity
Sometimes contextual classes cannot be applied due to the specificity of another selector. In some cases, a sufficient workaround is to wrap your element’s content in a <div> or more semantic element with the desired class.
Sass
In addition to the following Sass functionality, consider reading about our included CSS custom properties (aka CSS variables) for colors and more.
Variables
Most color utilities are generated by our theme colors, reassigned from our generic color palette variables.
$blue: #0d6efd; $indigo: #6610f2; $purple: #6f42c1; $pink: #d63384; $red: #dc3545; $orange: #fd7e14; $yellow: #ffc107; $green: #198754; $teal: #20c997; $cyan: #0dcaf0; $primary: $blue; $secondary: $gray-600; $success: $green; $info: $cyan; $warning: $yellow; $danger: $red; $light: $gray-100; $dark: $gray-900;Grayscale colors are also available, but only a subset are used to generate any utilities.
$white: #fff; $gray-100: #f8f9fa; $gray-200: #e9ecef; $gray-300: #dee2e6; $gray-400: #ced4da; $gray-500: #adb5bd; $gray-600: #6c757d; $gray-700: #495057; $gray-800: #343a40; $gray-900: #212529; $black: #000;Map
Theme colors are then put into a Sass map so we can loop over them to generate our utilities, component modifiers, and more.
$theme-colors: ( "primary": $primary, "secondary": $secondary, "success": $success, "info": $info, "warning": $warning, "danger": $danger, "light": $light, "dark": $dark );Grayscale colors are also available as a Sass map. This map is not used to generate any utilities.
$grays: ( "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 );Utilities API
Color utilities are declared in our utilities API in scss/_utilities.scss. Learn how to use the utilities API.
"color": ( property: color, class: text, values: map-merge( $theme-colors, ( "white": $white, "body": $body-color, "muted": $text-muted, "black-50": rgba($black, .5), "white-50": rgba($white, .5), "reset": inherit, ) ) ),Tag » Color Text Bootstrap
-
Colors - Bootstrap
-
Bootstrap 4 Colors - W3Schools
-
Bootstrap 5 Colors - W3Schools
-
Bootstrap Text Color - Examples & Tutorial
-
Text Colors And Background Colors Classes In Bootstrap 5 | Explained
-
How To Change Text And Background Colors In Bootstrap 4
-
Bootstrap Color Classes For Text, Background, Links And More
-
How Does Text Color Work In Bootstrap? - EduCBA
-
Bootstrap 4 | Colors - GeeksforGeeks
-
Bootstrap 4 - Colors - Tutorialspoint
-
Bootstrap Text Colors -- Tutorials With Advanced Examples - Torus Kit
-
Color Variants | Reference | BootstrapVue
-
Bootstrap 5 And Navbar Text Color - Stack Overflow