Customize
Color
felt-css keeps Bootstrap's colour meanings and dyes them like wool: denim, taupe, moss, tomato, mustard and petrol. Every colour is a custom property you can re-dye.
View page source on GitHubOn this page
Theme colors#
Like Bootstrap, felt-css has eight theme colours with the usual meanings. Their tones are chosen to look good as felt and work flat too.
<div class="row row-cols-2 row-cols-md-4 g-3">
<div class="col"><div class="p-3 rounded text-bg-primary">Primary · denim</div></div>
<div class="col"><div class="p-3 rounded text-bg-secondary">Secondary · taupe</div></div>
<div class="col"><div class="p-3 rounded text-bg-success">Success · moss</div></div>
<div class="col"><div class="p-3 rounded text-bg-danger">Danger · tomato</div></div>
<div class="col"><div class="p-3 rounded text-bg-warning">Warning · mustard</div></div>
<div class="col"><div class="p-3 rounded text-bg-info">Info · petrol</div></div>
<div class="col"><div class="p-3 rounded text-bg-light">Light</div></div>
<div class="col"><div class="p-3 rounded text-bg-dark">Dark</div></div>
</div>Each colour comes as a small family of tokens, Bootstrap's *-bg-subtle, *-border-subtle and *-text-emphasis included:
| Token | Use | Classes that use it |
|---|---|---|
--felt-primary | The fill: buttons, badges, progress bars, active items | .btn-primary, .bg-primary, .text-bg-primary |
--felt-primary-ink | Text on the fill, at least 4.5:1 | .text-bg-primary, .btn-primary |
--felt-primary-subtle | A tint of the fill on the current surface | .bg-primary-subtle, .alert-primary |
--felt-primary-border-subtle | A border on that tint | .border-primary-subtle |
--felt-primary-emphasis | Text on the tint, at least 4.5:1 | .text-primary-emphasis, .alert-primary |
--felt-primary-text | Coloured text directly on the page | .text-primary, .link-primary |
The same tokens exist for secondary, success, danger, warning, info, light and dark (light and dark have no -text). All of them, with their values in both looks:
| Token | Value | Bootstrap | Used for |
|---|---|---|---|
--felt-primary | light-dark(var(--felt-denim), #385c93) | --bs-primary | Primary fill |
--felt-primary-ink | #fff | Text and icons on the primary fill | |
--felt-secondary | light-dark(var(--felt-taupe), #6a5f52)felt light-dark(#716558, #6a5f52) | --bs-secondary | Secondary fill |
--felt-secondary-ink | #fff | Text and icons on the secondary fill | |
--felt-success | light-dark(var(--felt-moss), #527530)felt light-dark(#4e7225, #4f712c) | --bs-success | Success fill |
--felt-success-ink | #fff | Text and icons on the success fill | |
--felt-danger | light-dark(var(--felt-tomato), #b23f29)felt light-dark(#be3f29, #b23f29) | --bs-danger | Danger fill |
--felt-danger-ink | #fff | Text and icons on the danger fill | |
--felt-warning | light-dark(var(--felt-mustard), #cf9520) | --bs-warning | Warning fill |
--felt-warning-ink | #3a2a06 | Text and icons on the warning fill | |
--felt-info | light-dark(var(--felt-petrol), #276f75)felt light-dark(#227379, #276f75) | --bs-info | Info fill |
--felt-info-ink | #fff | Text and icons on the info fill | |
--felt-light | light-dark(#f8f9fa, #3b4148)felt light-dark(#f3ece0, #4a443d) | --bs-light | Light fill |
--felt-light-ink | light-dark(#1f2633, #e9ecef)felt light-dark(var(--felt-navy), #efe7da) | Text and icons on the light fill | |
--felt-dark | light-dark(#212529, #111315)felt light-dark(var(--felt-navy), #202840) | --bs-dark | Dark fill |
--felt-dark-ink | #f8f9fa | Text and icons on the dark fill | |
--felt-primary-emphasis | light-dark(#26406a, #a9c4ee) | --bs-primary-text-emphasis | Text on primary tints (.alert-primary, .text-primary-emphasis), 4.5:1 or more |
--felt-secondary-emphasis | light-dark(#4a4136, #d6cdbf) | --bs-secondary-text-emphasis | Text on secondary tints (.alert-secondary, .text-secondary-emphasis), 4.5:1 or more |
--felt-success-emphasis | light-dark(#36501d, #b0d18c)felt light-dark(#324c19, #b0d18c) | --bs-success-text-emphasis | Text on success tints (.alert-success, .text-success-emphasis), 4.5:1 or more |
--felt-danger-emphasis | light-dark(#7d2a1b, #f3a593) | --bs-danger-text-emphasis | Text on danger tints (.alert-danger, .text-danger-emphasis), 4.5:1 or more |
--felt-warning-emphasis | light-dark(#6b4e12, #f1cb72)felt light-dark(#5c4000, #f1cb72) | --bs-warning-text-emphasis | Text on warning tints (.alert-warning, .text-warning-emphasis), 4.5:1 or more |
--felt-info-emphasis | light-dark(#1b4f53, #94d3d6)felt light-dark(#174c50, #94d3d6) | --bs-info-text-emphasis | Text on info tints (.alert-info, .text-info-emphasis), 4.5:1 or more |
--felt-light-emphasis | light-dark(#495057, #dee2e6)felt light-dark(#3f464d, #dee2e6) | --bs-light-text-emphasis | Text on light tints (.alert-light, .text-light-emphasis), 4.5:1 or more |
--felt-dark-emphasis | light-dark(#343a40, #adb5bd) | --bs-dark-text-emphasis | Text on dark tints (.alert-dark, .text-dark-emphasis), 4.5:1 or more |
--felt-primary-text | light-dark(var(--felt-primary), #8fb2e8)felt var(--felt-link-color) | Primary as text on the page (.text-primary, .link-primary) | |
--felt-secondary-text | light-dark(var(--felt-secondary), #c4b9aa)felt light-dark(#584e43, #c4b9aa) | Secondary as text on the page (.text-secondary, .link-secondary) | |
--felt-success-text | light-dark(#4e6f2c, #98c26c)felt light-dark(#3b581e, #98c26c) | Success as text on the page (.text-success, .link-success) | |
--felt-danger-text | light-dark(var(--felt-danger), #ef8c76)felt light-dark(#932b16, #ef8c76) | Danger as text on the page (.text-danger, .link-danger) | |
--felt-warning-text | light-dark(#8a5f0c, var(--felt-warning))felt light-dark(#6d4900, var(--felt-warning)) | Warning as text on the page (.text-warning, .link-warning) | |
--felt-info-text | light-dark(var(--felt-info), #6cc3c8)felt light-dark(#0f585d, #6cc3c8) | Info as text on the page (.text-info, .link-info) | |
--felt-light-fixed | #f8f9fafelt #f3ece0 | Light that keeps its tone in dark mode, like Bootstrap's (.bg-light, .text-light) | |
--felt-dark-fixed | #212529felt var(--felt-navy) | Dark that keeps its tone in dark mode (.bg-dark, .text-dark) | |
--felt-primary-subtle | color-mix(in oklab, var(--felt-primary) 14%, var(--felt-surface)) | --bs-primary-bg-subtle | Primary tint (.bg-primary-subtle, .alert-primary) |
--felt-secondary-subtle | color-mix(in oklab, var(--felt-secondary) 14%, var(--felt-surface)) | --bs-secondary-bg-subtle | Secondary tint (.bg-secondary-subtle, .alert-secondary) |
--felt-success-subtle | color-mix(in oklab, var(--felt-success) 14%, var(--felt-surface)) | --bs-success-bg-subtle | Success tint (.bg-success-subtle, .alert-success) |
--felt-danger-subtle | color-mix(in oklab, var(--felt-danger) 14%, var(--felt-surface)) | --bs-danger-bg-subtle | Danger tint (.bg-danger-subtle, .alert-danger) |
--felt-warning-subtle | color-mix(in oklab, var(--felt-warning) 18%, var(--felt-surface)) | --bs-warning-bg-subtle | Warning tint (.bg-warning-subtle, .alert-warning) |
--felt-info-subtle | color-mix(in oklab, var(--felt-info) 14%, var(--felt-surface)) | --bs-info-bg-subtle | Info tint (.bg-info-subtle, .alert-info) |
--felt-light-subtle | color-mix(in oklab, var(--felt-light) 50%, var(--felt-surface)) | --bs-light-bg-subtle | Light tint (.bg-light-subtle, .alert-light) |
--felt-dark-subtle | color-mix(in oklab, var(--felt-dark) 20%, var(--felt-surface))felt color-mix(in oklab, var(--felt-secondary) 18%, var(--felt-surface)) | --bs-dark-bg-subtle | Dark tint (.bg-dark-subtle, .alert-dark) |
--felt-primary-border-subtle | color-mix(in oklab, var(--felt-primary) 32%, var(--felt-surface)) | --bs-primary-border-subtle | Border of primary tints |
--felt-secondary-border-subtle | color-mix(in oklab, var(--felt-secondary) 32%, var(--felt-surface)) | --bs-secondary-border-subtle | Border of secondary tints |
--felt-success-border-subtle | color-mix(in oklab, var(--felt-success) 32%, var(--felt-surface)) | --bs-success-border-subtle | Border of success tints |
--felt-danger-border-subtle | color-mix(in oklab, var(--felt-danger) 32%, var(--felt-surface)) | --bs-danger-border-subtle | Border of danger tints |
--felt-warning-border-subtle | color-mix(in oklab, var(--felt-warning) 40%, var(--felt-surface)) | --bs-warning-border-subtle | Border of warning tints |
--felt-info-border-subtle | color-mix(in oklab, var(--felt-info) 32%, var(--felt-surface)) | --bs-info-border-subtle | Border of info tints |
--felt-light-border-subtle | var(--felt-border-color) | --bs-light-border-subtle | Border of light tints |
--felt-dark-border-subtle | color-mix(in oklab, var(--felt-dark) 40%, var(--felt-surface)) | --bs-dark-border-subtle | Border of dark tints |
Palette#
The theme colours point at a small palette of wool dyes. Bootstrap's named colours have a felt counterpart each (blue is denim, red tomato …):
<div class="row row-cols-2 row-cols-md-4 g-3 small">
<div class="col"><div class="p-3 rounded text-white" style="background: var(--felt-denim)">--felt-denim</div></div>
<div class="col"><div class="p-3 rounded text-white" style="background: var(--felt-taupe)">--felt-taupe</div></div>
<div class="col"><div class="p-3 rounded text-white" style="background: var(--felt-moss)">--felt-moss</div></div>
<div class="col"><div class="p-3 rounded text-white" style="background: var(--felt-tomato)">--felt-tomato</div></div>
<div class="col"><div class="p-3 rounded" style="background: var(--felt-mustard); color: #3a2a06">--felt-mustard</div></div>
<div class="col"><div class="p-3 rounded text-white" style="background: var(--felt-petrol)">--felt-petrol</div></div>
<div class="col"><div class="p-3 rounded text-white" style="background: var(--felt-navy)">--felt-navy</div></div>
<div class="col"><div class="p-3 rounded text-white" style="background: var(--felt-indigo)">--felt-indigo</div></div>
<div class="col"><div class="p-3 rounded text-white" style="background: var(--felt-plum)">--felt-plum</div></div>
<div class="col"><div class="p-3 rounded text-white" style="background: var(--felt-rose)">--felt-rose</div></div>
<div class="col"><div class="p-3 rounded text-white" style="background: var(--felt-pumpkin)">--felt-pumpkin</div></div>
<div class="col"><div class="p-3 rounded text-white" style="background: var(--felt-lagoon)">--felt-lagoon</div></div>
</div>| Token | Value | Bootstrap | Used for |
|---|---|---|---|
--felt-mustard | #e0a224 | --bs-yellow | Warning |
--felt-denim | #3d64a0 | --bs-blue | Primary |
--felt-moss | #5a7f33 | --bs-green | Success |
--felt-tomato | #c4452f | --bs-red | Danger |
--felt-petrol | #2b7a80 | --bs-teal | Info |
--felt-taupe | #7a6e60 | Secondary | |
--felt-navy | #1e2b45 | Ink of the felt look | |
--felt-indigo | #4b4f9c | --bs-indigo | Indigo felt |
--felt-plum | #7b4a82 | --bs-purple | Purple felt |
--felt-rose | #c45a78 | --bs-pink | Pink felt |
--felt-pumpkin | #d6772e | --bs-orange | Orange felt |
--felt-lagoon | #3a9bb2 | --bs-cyan | Cyan felt |
--felt-black | #000 | --bs-black | Black |
--felt-white | #fff | --bs-white | White |
Grays#
A gray scale from 100 to 900 that, like Bootstrap's, doesn't follow the colour mode. In the clean look it is Bootstrap's grays; in the felt look warm grays from cream to charcoal, so a gray piece still looks like wool.
<div class="d-flex flex-wrap gap-2 small">
<div class="p-3 rounded" style="background: var(--felt-gray-100)">100</div>
<div class="p-3 rounded" style="background: var(--felt-gray-200)">200</div>
<div class="p-3 rounded" style="background: var(--felt-gray-300)">300</div>
<div class="p-3 rounded" style="background: var(--felt-gray-400)">400</div>
<div class="p-3 rounded" style="background: var(--felt-gray-500)">500</div>
<div class="p-3 rounded text-white" style="background: var(--felt-gray-600)">600</div>
<div class="p-3 rounded text-white" style="background: var(--felt-gray-700)">700</div>
<div class="p-3 rounded text-white" style="background: var(--felt-gray-800)">800</div>
<div class="p-3 rounded text-white" style="background: var(--felt-gray-900)">900</div>
</div>| Token | Value | Bootstrap | Used for |
|---|---|---|---|
--felt-gray-100 | #f8f9fafelt #f5efe5 | --bs-gray-100 | Gray 100 |
--felt-gray-200 | #e9eceffelt #e9e1d3 | --bs-gray-200 | Gray 200 |
--felt-gray-300 | #dee2e6felt #d9cfbe | --bs-gray-300 | Gray 300 |
--felt-gray-400 | #ced4dafelt #bcb09c | --bs-gray-400 | Gray 400 |
--felt-gray-500 | #adb5bdfelt #9b8f7c | --bs-gray-500 | Gray 500 |
--felt-gray-600 | #6c757dfelt #7a6e60 | --bs-gray--bs-gray-600 | Gray 600 |
--felt-gray-700 | #495057felt #5e554a | --bs-gray-700 | Gray 700 |
--felt-gray-800 | #343a40felt #433d36 | --bs-gray-800--bs-gray-dark | Gray 800 |
--felt-gray-900 | #212529felt #2b2723 | --bs-gray-900 | Gray 900 |
Light and dark#
Theme tokens are written as light-dark(light, dark). Dark mode mutes the fills a little, so they glare less and white ink stays readable:
:root {
--felt-primary: light-dark(var(--felt-denim), #385c93);
--felt-primary-ink: #fff;
--felt-primary-emphasis: light-dark(#26406a, #a9c4ee);
}Tints (*-subtle, *-border-subtle) are mixed from the fill and the current surface with color-mix(), so they follow the theme without a second value.
Re-dyeing#
To change a colour, override its tokens in your own stylesheet. There's no build step: the whole sheet — buttons, alerts, focus rings, the felt patches — takes the new dye.
:root {
--felt-primary: light-dark(#7a3d8f, #6c3780); /* heather instead of denim */
--felt-primary-ink: #fff;
--felt-primary-emphasis: light-dark(#4d2259, #dcb5e8);
--felt-primary-text: light-dark(#7a3d8f, #cfa2df);
--felt-link-color: light-dark(var(--felt-primary), #cfa2df);
}Keep *-ink and *-emphasis readable when you change a fill: felt-css aims for at least 4.5:1 contrast for text on fills and on tints, in both modes.
Surfaces and text#
Neutral colours are tokens too. See CSS variables for the full list.
--felt-body-bg page--felt-surface cards, fields--felt-surface-sunk wells, code--felt-surface-raised raised--felt-surface-overlay menus, modals--felt-field inputs<div class="row row-cols-1 row-cols-md-3 g-3 small">
<div class="col"><div class="p-3 rounded border" style="background: var(--felt-body-bg)"><code>--felt-body-bg</code> page</div></div>
<div class="col"><div class="p-3 rounded border" style="background: var(--felt-surface)"><code>--felt-surface</code> cards, fields</div></div>
<div class="col"><div class="p-3 rounded border" style="background: var(--felt-surface-sunk)"><code>--felt-surface-sunk</code> wells, code</div></div>
<div class="col"><div class="p-3 rounded border" style="background: var(--felt-surface-raised)"><code>--felt-surface-raised</code> raised</div></div>
<div class="col"><div class="p-3 rounded border" style="background: var(--felt-surface-overlay)"><code>--felt-surface-overlay</code> menus, modals</div></div>
<div class="col"><div class="p-3 rounded border" style="background: var(--felt-field)"><code>--felt-field</code> inputs</div></div>
</div>