Theming
Compose light and dark modes, five color palettes, rounded or square corners, and semantic design-token overrides.
Theming
Boobstrap themes have four independent axes: color mode, palette, corner shape, and scrollbar presentation. Combine their data attributes on <html> for an application-wide theme or on a component boundary for a scoped preview.
| Axis | Attribute | Values | Default |
|---|---|---|---|
| Color mode | data-bs-theme | dark, light | dark |
| Palette | data-bs-palette | rose, violet, blue, teal, amber | rose |
| Corner scale | data-bs-radius | small, normal, large, rounded, square | normal |
| Scrollbars | data-bs-scrollbars | themed, native | themed |
Compose a theme
Try every supported combination below. The preview applies the same public attributes and semantic tokens that your application will use.
One contract, many expressions
Surfaces, text, controls, focus states, gradients, shadows, and component geometry all follow the selected tokens.
Create a workspace
Components consume semantic tokens instead of palette-specific colors.
<html
data-bs-theme="dark"
data-bs-palette="rose"
data-bs-radius="normal"
>
Mode
Mode remaps surfaces, text, borders, controls, shadows, and contrast for dark or light environments.
Palette
Palette remaps the brand scale and every connected semantic accent, including primary states, focus rings, gradients, and brand shadows.
Corners
Small, normal, and large presets remap the complete radius scale, including scrollbar thumbs. rounded aliases normal for compatibility; square sets every corner to zero.
Themed scrollbars
Boobstrap applies theme-aware scrollbars by default, using --bs-scrollbar-thumb, --bs-scrollbar-track, and --bs-scrollbar-size. The themed presentation contains only the track and draggable thumb; browser arrow buttons are hidden. Set data-bs-scrollbars="native" on <html> or a subtree to restore the browser presentation. Inside a native subtree, .bs-scrollbar opts one scroll container back into the themed treatment. The legacy themed value remains compatible but is no longer required.
Scrollbar thumb corners consume --bs-radius-pill, so radius presets apply consistently: data-bs-radius="square" produces square scrollbar thumbs instead of rounded ones.
<html data-bs-scrollbars="native">
...browser-native scrollbars throughout the document...
</html>
<section data-bs-scrollbars="native">
...browser-native scrollbars in this subtree...
<div class="bs-scrollbar">...one themed exception...</div>
</section>Complete color token reference
The tables below are generated from the compiled framework stylesheet used by this site. They list the complete brand ramp and every --bs-color-* token for all five palettes in both modes, including exact hex and alpha-channel values.
Palette brand scales
Primitive accent steps shared by dark and light mode for each palette.
| Token | Rose | Violet | Blue | Teal | Amber |
|---|---|---|---|---|---|
--bs-brand-300 | #f28abb | #c4b5fd | #93c5fd | #5eead4 | #fcd34d |
--bs-brand-400 | #ea5a9f | #a78bfa | #60a5fa | #2dd4bf | #fbbf24 |
--bs-brand-500 | #d83c87 | #8b5cf6 | #3b82f6 | #14b8a6 | #f59e0b |
--bs-brand-600 | #b92f72 | #7c3aed | #2563eb | #0d9488 | #d97706 |
--bs-brand-700 | #922257 | #6d28d9 | #1d4ed8 | #0f766e | #b45309 |
Dark mode semantic colors
Resolved component-facing colors when data-bs-theme is dark.
| Token | Rose | Violet | Blue | Teal | Amber |
|---|---|---|---|---|---|
--bs-color-background | #140a15 | #0f0b1a | #071321 | #061715 | #1a1005 |
--bs-color-surface | #211021 | #18112b | #0c1d31 | #0b2421 | #291a08 |
--bs-color-surface-raised | #2b1529 | #21183a | #112842 | #10312d | #38240d |
--bs-color-surface-hover | #32172f | #2b2048 | #183553 | #17413b | #4a3011 |
--bs-color-text | #fff9fc | #fbf9ff | #f6faff | #f3fffc | #fffbeb |
--bs-color-text-muted | #c4b5bf | #c2b8d1 | #b4c2d3 | #acc9c3 | #d1c09f |
--bs-color-text-subtle | #95858f | #9185a2 | #8193aa | #789d95 | #a18c68 |
--bs-color-primary | #d83c87 | #a78bfa | #60a5fa | #2dd4bf | #fbbf24 |
--bs-color-primary-hover | #ea5a9f | #c4b5fd | #93c5fd | #5eead4 | #fcd34d |
--bs-color-primary-active | #b92f72 | #8b5cf6 | #3b82f6 | #14b8a6 | #f59e0b |
--bs-color-primary-contrast | #ffffff | #ffffff | #ffffff | #ffffff | #ffffff |
--bs-color-focus-ring | rgb(234 90 159 / 42%) | rgb(167 139 250 / 40%) | rgb(96 165 250 / 40%) | rgb(45 212 191 / 38%) | rgb(251 191 36 / 38%) |
--bs-color-success | #36b37e | #36b37e | #36b37e | #36b37e | #36b37e |
--bs-color-warning | #e6a23c | #e6a23c | #e6a23c | #e6a23c | #e6a23c |
--bs-color-danger | #e05268 | #e05268 | #e05268 | #e05268 | #e05268 |
--bs-color-info | #618ee8 | #618ee8 | #618ee8 | #618ee8 | #618ee8 |
--bs-color-border | rgb(255 255 255 / 10%) | rgb(255 255 255 / 10%) | rgb(255 255 255 / 10%) | rgb(255 255 255 / 10%) | rgb(255 255 255 / 10%) |
--bs-color-border-strong | rgb(216 60 135 / 38%) | rgb(167 139 250 / 38%) | rgb(96 165 250 / 38%) | rgb(45 212 191 / 36%) | rgb(251 191 36 / 36%) |
--bs-color-control-background | rgb(12 5 14 / 42%) | rgb(8 5 17 / 45%) | rgb(4 12 22 / 45%) | rgb(3 14 13 / 46%) | rgb(16 9 2 / 46%) |
Light mode semantic colors
Resolved component-facing colors when data-bs-theme is light.
| Token | Rose | Violet | Blue | Teal | Amber |
|---|---|---|---|---|---|
--bs-color-background | #fffafd | #fbfaff | #f8fbff | #f6fdfb | #fffbf5 |
--bs-color-surface | #ffffff | #ffffff | #ffffff | #ffffff | #ffffff |
--bs-color-surface-raised | #ffffff | #ffffff | #ffffff | #ffffff | #ffffff |
--bs-color-surface-hover | #f8edf3 | #f3efff | #edf5ff | #e9f8f4 | #fff4df |
--bs-color-text | #2b1725 | #251a35 | #142337 | #15302d | #38240d |
--bs-color-text-muted | #715f6b | #665a76 | #52647a | #526f69 | #745f43 |
--bs-color-text-subtle | #93828d | #8c8198 | #7c8da1 | #7b9690 | #9a8669 |
--bs-color-primary | #c93179 | #6d28d9 | #1d4ed8 | #0f766e | #b45309 |
--bs-color-primary-hover | #ae2868 | #5b21b6 | #1e40af | #115e59 | #92400e |
--bs-color-primary-active | #8f2057 | #4c1d95 | #1e3a8a | #134e4a | #78350f |
--bs-color-primary-contrast | #ffffff | #ffffff | #ffffff | #ffffff | #ffffff |
--bs-color-focus-ring | rgb(201 49 121 / 28%) | rgb(109 40 217 / 27%) | rgb(29 78 216 / 26%) | rgb(15 118 110 / 26%) | rgb(180 83 9 / 26%) |
--bs-color-success | #36b37e | #36b37e | #36b37e | #36b37e | #36b37e |
--bs-color-warning | #e6a23c | #e6a23c | #e6a23c | #e6a23c | #e6a23c |
--bs-color-danger | #e05268 | #e05268 | #e05268 | #e05268 | #e05268 |
--bs-color-info | #618ee8 | #618ee8 | #618ee8 | #618ee8 | #618ee8 |
--bs-color-border | #eadce4 | #e8e0f3 | #dce8f5 | #d8ebe6 | #f0e2cc |
--bs-color-border-strong | #dcb7ca | #cbbbec | #b5cdea | #afd3ca | #ddc29a |
--bs-color-control-background | #ffffff | #ffffff | #ffffff | #ffffff | #ffffff |
rgb(... / ...%) notation so their alpha channel remains explicit. The complete non-color token inventory is available in Design tokens.Set a document default
Place all three attributes on the same theme boundary. Omitting an attribute uses its default, but explicit values make application intent easier to audit.
<html data-bs-theme="light" data-bs-palette="teal" data-bs-radius="square">
<body>...</body>
</html>
Scope a themed region
Attributes may live on any ancestor, so previews, dashboards, or embedded product areas can use their own combination without changing the surrounding page.
<section data-bs-theme="dark" data-bs-palette="violet" data-bs-radius="rounded">
<article class="bs-card bs-card-body">...</article>
</section>
Customize semantic tokens
Override tokens after importing Boobstrap. Define the complete primary state set—including readable foreground and focus treatment—so buttons, forms, alerts, tabs, and badges stay visually coherent.
[data-product-theme] {
--bs-color-primary: #6d4aff;
--bs-color-primary-hover: #8568ff;
--bs-color-primary-active: #5638d6;
--bs-color-primary-contrast: #ffffff;
--bs-color-focus-ring: rgb(109 74 255 / 30%);
--bs-radius-md: 0.5rem;
}
Prefer --bs-color-*, --bs-radius-*, --bs-shadow-*, and --bs-gradient-* over component-specific color patches. Re-check text, control, and focus contrast in both modes.
Scope a complete theme to one region
All three attributes inherit through a subtree, which is useful for embedded products, dashboards, and previews with a distinct visual identity.
Scoped independently
The surrounding page keeps its own mode, palette, and corners.
<div class="bs-card" data-bs-theme="light" data-bs-palette="teal" data-bs-radius="square">
<div class="bs-card-body">
<span class="bs-badge bs-badge-primary">Light · Teal · Square</span>
<h3 class="bs-card-title bs-mt-4">Scoped independently</h3>
<p class="bs-card-text bs-mb-4">The surrounding page keeps its own mode, palette, and corners.</p>
<button class="bs-btn bs-btn-primary bs-btn-sm" type="button">Continue</button>
</div>
</div>Persist a mode preference
Mode can change without disturbing the selected palette or corner profile. Apply a stored preference before paint when possible to avoid a visual flash.
const root = document.documentElement;
const toggle = document.querySelector("[data-theme-toggle]");
toggle.addEventListener("click", () => {
const next = root.dataset.bsTheme === "light" ? "dark" : "light";
root.dataset.bsTheme = next;
localStorage.setItem("theme", next);
});