Customize
Felt
The felt look has variables of its own: the textures, how deep the pieces lie, the grooves pressed into them and the thread they're sewn with. Tune the felt for your app.
View page source on GitHubOn this page
Tuning the felt#
Everything you see in the felt look — the fibres, the thickness of a piece, the thread — comes from the variables on this page. They only act in the felt look (their names carry a material word: texture, sheet, nap, wool, patch, groove, seam, thread or stitch), and like all variables they can be set for the whole page or for one part of it:
:root[data-look="felt"] {
--felt-thread-strength: .9; /* bolder seams */
--felt-seam-inset: 7px; /* sewn further in from the edge */
}
.card.quiet { --felt-patch-shadow: none; } /* a card that lies flat */<div class="d-flex flex-wrap gap-3">
<button type="button" class="btn btn-primary">Default</button>
<button type="button" class="btn btn-primary" style="--felt-thread-strength-patch: .95">Bold thread</button>
<button type="button" class="btn btn-primary" style="--felt-thread-strength-patch: .2">Faint thread</button>
<button type="button" class="btn btn-light border-danger">Dyed thread</button>
</div>Switch to the felt look at the top of the page to see them; in the clean look they do nothing. Many values differ in dark mode, where the felt is charcoal.
The seam images are generated: tools/build_assets.py draws the stitches and grooves. For a different stitch length or rounder corners change the script rather than the sizes here.
Textures#
| Token | Value | Used for |
|---|---|---|
--felt-texture | felt url("img/felt.webp") | Felt of coloured patches (grey, blended in soft-light) |
--felt-texture-size | felt 256px | Its tile size |
--felt-texture-light | felt url("img/felt-light.webp") | Cream felt, multiplied into light pieces |
--felt-texture-light-size | felt 256px | Its tile size |
--felt-texture-dark | felt url("img/felt-dark.webp") | Charcoal felt for light pieces in dark mode |
--felt-texture-sheet | felt var(--felt-texture-light) dark var(--felt-texture-dark) | The sheet light pieces are cut from in this mode |
--felt-texture-sheet-size | felt var(--felt-texture-light-size) | Its tile size |
--felt-texture-sheet-blend | felt multiply dark soft-light | How the sheet is blended into a piece's colour |
--felt-texture-veil | felt transparent dark color-mix(in srgb, var(--felt-body-bg) 30%, transparent) | A veil over the page's felt, so it is the quietest of all |
Patches and depth#
| Token | Value | Used for |
|---|---|---|
--felt-patch-shadow | felt 0 0 0 1px light-dark(rgb(80 60 40 / .16), transparent), 0 0 1px .5px light-dark(transparent, rgb(0 0 0 / .35)), 0 0 0 .5px light-dark(transparent, rgb(255 240 220 / .06)), inset 0 -2px 0 light-dark(rgb(80 60 40 / .14), rgb(0 0 0 / .14)), inset 0 1px 0 light-dark(rgb(255 255 255 / .08), rgb(255 240 220 / .09)), 0 1px 0 light-dark(rgb(80 60 40 / .22), rgb(0 0 0 / .45)), 0 1px 1.5px light-dark(rgb(70 50 30 / .32), transparent), 0 4px 12px light-dark(rgb(70 50 30 / .16), transparent), 0 6px 14px -6px light-dark(transparent, rgb(0 0 0 / .6)) | Large pieces (cards, navbar, list groups, modals): in light mode a dark cut edge and a contact shadow, in the dark a soft rim and a wide halo |
--felt-patch-dome | felt radial-gradient(120% 95% at 35% 10%, rgb(255 255 255 / .2), transparent 60%) | The light on a coloured patch's swell |
--felt-patch-cut | felt light-dark(#2a1a08, #000) | What a patch's cut edge is darkened with |
--felt-patch-edge-light | felt light-dark(#cbbca2, #1d1a17) | Cut edge of light patches |
--felt-patch-shadow-near | felt light-dark(rgb(60 40 15 / .26), rgb(0 0 0 / .35)) | Patches' short cast shadow |
--felt-patch-shadow-far | felt light-dark(rgb(60 40 15 / .36), rgb(0 0 0 / .5)) | Patches' long cast shadow |
Grooves and nap#
| Token | Value | Used for |
|---|---|---|
--felt-groove-bg | felt light-dark(rgb(90 70 40 / .13), rgb(0 0 0 / .3)) | A groove's shade: translucent, so the fibres of the piece run through |
--felt-groove-shade | felt light-dark(rgb(70 50 20 / .16), rgb(0 0 0 / .45)) | A groove's shaded top wall |
--felt-groove-lip | felt light-dark(rgb(255 255 255 / .35), rgb(255 255 255 / .06)) | A groove's lit lower lip |
--felt-groove-shadow | felt light-dark(rgb(70 50 20 / .25), rgb(0 0 0 / .5)) | Inset shadow of pressed felt |
--felt-groove-shadow-field | felt light-dark(rgb(60 40 20 / .08), rgb(0 0 0 / .3)) | Inset shadow of fields and checks |
--felt-nap-highlight | felt light-dark(rgb(255 255 255 / .5), rgb(255 240 220 / .07)) | Light catching the nap at an edge |
--felt-groove-fold | felt inset 1px 0 0 color-mix(in srgb, var(--felt-groove-shadow) 55%, transparent), inset 2px 0 0 color-mix(in srgb, var(--felt-nap-highlight) 40%, transparent) | A fold pressed into one piece where two parts meet (left edge): button groups, horizontal lists, table columns |
--felt-groove-fold-y | felt inset 0 1px 0 color-mix(in srgb, var(--felt-groove-shadow) 55%, transparent), inset 0 2px 0 color-mix(in srgb, var(--felt-nap-highlight) 28%, transparent) | The same at the top edge |
--felt-wool | felt #fff4e0 | Undyed wool: what white pieces (swatches, range thumbs, light dots) are dyed |
--felt-wool-knob | felt light-dark(#fbf7ee, #e4dccd) | The switch's knob |
Seams and thread#
The thread's colour is a filter on the drawn stitches, blended into the felt with hard-light: on light felt a darker tone of the felt, on coloured patches a lighter one. Border utilities dye it (.border-primary in the felt look is thread in the primary colour); for a colour of your own, use --felt-thread-filter and its variants.
| Token | Value | Used for |
|---|---|---|
--felt-thread-relief | felt drop-shadow(0 .5px 0 rgb(255 255 255 / .3)) dark drop-shadow(0 1px 0 rgb(0 0 0 / .7)) drop-shadow(0 -.5px 0 rgb(255 240 220 / .12)) | Light and shadow along the thread |
--felt-thread-filter | felt brightness(.42) sepia(.3) var(--felt-thread-relief) dark brightness(.67) sepia(.22) var(--felt-thread-relief) | Thread colour on light felt |
--felt-thread-filter-cream | felt brightness(.4) sepia(.45) var(--felt-thread-relief) | Thread on the lightest felt (cream pieces): a little darker |
--felt-thread-filter-patch | felt brightness(1) dark brightness(.9) | Thread on coloured patches: a lighter tone of the patch |
--felt-thread-filter-ink | felt brightness(.5) contrast(4) brightness(.5) sepia(.5) hue-rotate(180deg) saturate(1.5) drop-shadow(0 .5px 0 rgb(255 255 255 / .35)) dark brightness(.92) sepia(.15) drop-shadow(0 1px 0 rgb(0 0 0 / .7)) drop-shadow(0 -.5px 0 rgb(255 240 220 / .12)) | Thread in the ink's tone, for a mark sewn into any felt (a chosen swatch's ring) |
--felt-thread-strength | felt .72 dark .52 | How strongly the thread shows on light felt (0–1) |
--felt-thread-strength-patch | felt .55 dark .38 | … on coloured patches |
--felt-thread-strength-row | felt .58 | Stitch rows dividing a piece, relative to its outer seam |
--felt-thread-strength-rule | felt .4 | hr and .vr |
--felt-seam-inset | felt 5px | How far in from the edge a seam is sewn (cards and other large pieces: 9px) |
--felt-stitch-length | felt 7px | Length of a stitch in SVG drawings (.stitches) |
--felt-stitch-pitch | felt 10px | Stitch plus gap |
--felt-stitch-shadow | felt drop-shadow(0 .55px .5px rgb(0 0 0 / .25)) | The thread's shadow in SVG drawings |
Per component#
Components with a felt treatment of their own list their felt variables on their page, under “CSS”, next to their Bootstrap variables.