Skip to main content

Customize

Color

Eleven theme colors, their emphasis and subtle variants, the raw palette, and how the theme keeps text readable on gold.

Theme colors

Bootstrap's eight theme colors are remapped to the RopeBreak.net palette, and three raw brand colors join them as first-class theme colors. All eleven get the full set of classes: .btn-*, .btn-outline-*, .bg-*, .text-*, .text-bg-*, .border-*, .link-*, .alert-*, .list-group-item-*, .focus-ring-*, and --bs-* / --bs-*-rgb variables.

primary
gold-700 #b8941f · dark: gold-500
secondary
navy-400 #4a6398
success
green-600 #277432
info
navy-500 #1e3a6e
warning
gold-300 #e6c769
danger
red-600 #b3261e
light
cream-50 #faf3df
dark
navy-900 #0a1b3d
gold
gold-500 #d4af37
navy
navy-700 #122553
cream
cream-100 #f4ecd8

What each one means in the ring:

  • primary — title-belt gold. The championship. One per screen is plenty.
  • secondary — "tale of the tape" stat blue. Supporting actions.
  • success — three-count green. Quiet; confirmations only.
  • info — bracket-board navy.
  • warning — the top of the gold ramp.
  • danger — red corner, DQ.
  • light / cream — program paper. dark / navy — arena black-out.
  • gold — the mid gold, for when you want the belt color regardless of mode.
HTML
<button type="button" class="btn btn-primary">Primary</button>
<button type="button" class="btn btn-secondary">Secondary</button>
<button type="button" class="btn btn-success">Success</button>
<button type="button" class="btn btn-info">Info</button>
<button type="button" class="btn btn-warning">Warning</button>
<button type="button" class="btn btn-danger">Danger</button>
<button type="button" class="btn btn-light">Light</button>
<button type="button" class="btn btn-dark">Dark</button>
<button type="button" class="btn btn-gold">Gold</button>
<button type="button" class="btn btn-navy">Navy</button>
<button type="button" class="btn btn-cream">Cream</button>

Emphasis, subtle background, subtle border

Each theme color has a triplet for text-on-tint layouts: a darker (or, in dark mode, paler) text color, a pale background and a pale border. Alerts and list-group variants are built from them.

Color-text-emphasis-bg-subtle-border-subtle
primary#6b5410 / gold-300#f3e8c3 / #3a2f0agold-300 / gold-700
secondarynavy-700 / navy-100navy-50 / navy-700navy-100 / navy-500
success#1b4d1e / #8fd092#dcecdc / #10290f#a9d1ab / #1b4d1e
infonavy-900 / navy-100navy-50 / navy-700navy-100 / navy-500
warning#6b5410 / gold-300#faf1d2 / #3a2f0agold-300 / gold-700
danger#6b1712 / #f0a19a#f3d7d5 / #3d0d0a#e2a19c / #6b1712
lightnavy-700 / cream-50cream-50 / navy-700cream-300 / navy-500
darknavy-900 / cream-100navy-100 / #06122anavy-300 / navy-700
gold#6b5410 / gold-300#f3e8c3 / #3a2f0agold-300 / gold-700
navynavy-900 / navy-100navy-50 / navy-700navy-100 / navy-500
creamnavy-700 / cream-50cream-50 / #2b2614cream-300 / #5c5230

Values are light / dark. The utilities are .text-{color}-emphasis, .bg-{color}-subtle and .border-{color}-subtle.

.text-primary-emphasis .bg-primary-subtle .border-primary-subtle
.text-danger-emphasis .bg-danger-subtle .border-danger-subtle
.text-success-emphasis .bg-success-subtle .border-success-subtle
var(--bs-navy-text-emphasis) / -bg-subtle / -border-subtle
HTML
<div class="p-3 text-primary-emphasis bg-primary-subtle border border-primary-subtle rounded">.text-primary-emphasis .bg-primary-subtle .border-primary-subtle</div>
<div class="p-3 text-danger-emphasis bg-danger-subtle border border-danger-subtle rounded">.text-danger-emphasis .bg-danger-subtle .border-danger-subtle</div>
<div class="p-3 text-success-emphasis bg-success-subtle border border-success-subtle rounded">.text-success-emphasis .bg-success-subtle .border-success-subtle</div>
<div class="p-3 rounded" style="color: var(--bs-navy-text-emphasis); background: var(--bs-navy-bg-subtle); border: 1px solid var(--bs-navy-border-subtle)">var(--bs-navy-text-emphasis) / -bg-subtle / -border-subtle</div>
The -emphasis and -subtle utility classes exist for the eight Bootstrap colors only. For gold, navy and cream the variables are defined (--bs-gold-text-emphasis, --bs-cream-bg-subtle, --bs-navy-border-subtle, …) but there is no .text-gold-emphasis class yet. Use the variable, or .alert-gold / .list-group-item-navy, which are built from the same values.

Raw palette

The fourteen palette colors are also in Bootstrap's $colors map, so --bs-navy-500, --bs-gold-300, --bs-cream-50 and friends exist on the root alongside --bs-blue and --bs-yellow. There are no utility classes for them. Prefer the semantic variables; reach for the raw ones when you need a specific step of a ramp.

--bs-navy-900 --bs-navy-500 --bs-navy-100 --bs-gold-300 --bs-gold-500 --bs-gold-700 --bs-cream-300
HTML
<span class="badge" style="background: var(--bs-navy-900); color: var(--bs-cream-50)">--bs-navy-900</span>
<span class="badge" style="background: var(--bs-navy-500); color: var(--bs-cream-50)">--bs-navy-500</span>
<span class="badge" style="background: var(--bs-navy-100); color: var(--bs-navy-900)">--bs-navy-100</span>
<span class="badge" style="background: var(--bs-gold-300); color: var(--bs-navy-900)">--bs-gold-300</span>
<span class="badge" style="background: var(--bs-gold-500); color: var(--bs-navy-900)">--bs-gold-500</span>
<span class="badge" style="background: var(--bs-gold-700); color: var(--bs-navy-900)">--bs-gold-700</span>
<span class="badge" style="background: var(--bs-cream-300); color: var(--bs-navy-900)">--bs-cream-300</span>

Full list with hex values on Tokens.

Text on a background

.text-bg-{color} sets the background and picks a readable text color for it in one class. It is the right class for badges and small blocks.

primary secondary success info warning danger light dark gold navy cream
HTML
<span class="badge text-bg-primary">primary</span>
<span class="badge text-bg-secondary">secondary</span>
<span class="badge text-bg-success">success</span>
<span class="badge text-bg-info">info</span>
<span class="badge text-bg-warning">warning</span>
<span class="badge text-bg-danger">danger</span>
<span class="badge text-bg-light">light</span>
<span class="badge text-bg-dark">dark</span>
<span class="badge text-bg-gold">gold</span>
<span class="badge text-bg-navy">navy</span>
<span class="badge text-bg-cream">cream</span>

.text-bg-navy

cream-50 text on navy-700. Links inside: use .link-light.

.text-bg-gold

navy-900 text on gold-500. The belt plate.

HTML
<div class="p-4 text-bg-navy rounded mb-2">
  <p class="h3 mb-1">.text-bg-navy</p>
  <p class="mb-0">cream-50 text on navy-700. Links inside: <a href="#color-tbg-link" id="color-tbg-link" class="link-light">use .link-light</a>.</p>
</div>
<div class="p-4 text-bg-gold rounded">
  <p class="h3 mb-1">.text-bg-gold</p>
  <p class="mb-0">navy-900 text on gold-500. The belt plate.</p>
</div>

Contrast

Bootstrap's color-contrast() function chooses the text color for every .btn-*, .text-bg-* and badge at compile time. The theme feeds it three settings from scss/_variables.scss:

$min-contrast-ratio: 4.5;             // WCAG AA for normal text
$color-contrast-dark: $rb-navy-900;   // tried first on light backgrounds
$color-contrast-light: $rb-cream-50;  // tried first on dark backgrounds

For each background it tests cream-50, navy-900, then white and black, and takes the first that reaches 4.5:1. If none does, it takes the highest. That is how the decisions below fall out:

BackgroundChosen textRatioWhy
primary (gold-700)navy-900≈ 5.9:1cream-50 only reaches ≈ 2.6:1
gold (gold-500)navy-900≈ 8.1:1
warning (gold-300)navy-900≈ 10:1
navy (navy-700), info, darkcream-50≈ 13:1 and up
success, dangercream-50> 4.5:1
light, creamnavy-900≈ 15:1
secondary (navy-400)cream-50≈ 5.4:1navy-300 missed with every foreground; navy-400 is the same hue stepped down until cream-50 passes

Guidance when you pick colors by hand:

  • Gold text on cream fails. .text-primary on the page background is about 2.5:1. Use .text-primary-emphasis (≈ 6:1) for anything that must be read. Gold on navy is fine (gold-700 ≈ 5.9:1, gold-500 ≈ 8:1, gold-300 ≈ 10:1).
  • Gold backgrounds take navy text. Never white. .text-bg-gold and .btn-gold already do this.
  • Secondary is a mid tone. Do not put cream or navy body text on .bg-secondary; use the .text-bg-secondary pairing (white) or a subtle variant.
  • Links keep the underline. The hover color is gold-700, which on cream is decorative, so the underline does the work.
  • Dark mode shifts the emphasis colors up, not just the backgrounds. A .text-*-emphasis that passed in light passes in dark too.

.text-primary — decorative gold

.text-primary-emphasis — readable gold

.text-secondary — navy-400, about 5:1, fine for muted labels

.text-body-secondary — the same tone through the body variable

HTML
<p class="text-primary mb-1">.text-primary — decorative gold</p>
<p class="text-primary-emphasis mb-1">.text-primary-emphasis — readable gold</p>
<p class="text-secondary mb-1">.text-secondary — navy-400, about 5:1, fine for muted labels</p>
<p class="text-body-secondary mb-0">.text-body-secondary — the same tone through the body variable</p>

More on reading order, focus and motion on Accessibility.

Sass

Theme colors are assigned in scss/_variables.scss; the three extras are merged in scss/_maps.scss.

$primary: $rb-gold-700;
$secondary: $rb-navy-400;
$success: $rb-green-600;
$info: $rb-navy-500;
$warning: $rb-gold-300;
$danger: $rb-red-600;
$light: $rb-cream-50;
$dark: $rb-navy-900;

$rb-theme-colors: (
  "gold": $rb-gold-500,
  "navy": $rb-navy-700,
  "cream": $rb-cream-100,
);
$theme-colors: map-merge($theme-colors, $rb-theme-colors);

To change a theme color, override the palette variable it comes from rather than the Bootstrap variable, so the --rb-* and --color-* layers stay in step. Adding a fourth extra color is covered on Components.