Skip to main content

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 GitHub

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#

TokenValueUsed for
--felt-texturefelt url("img/felt.webp")Felt of coloured patches (grey, blended in soft-light)
--felt-texture-sizefelt 256pxIts tile size
--felt-texture-lightfelt url("img/felt-light.webp")Cream felt, multiplied into light pieces
--felt-texture-light-sizefelt 256pxIts tile size
--felt-texture-darkfelt url("img/felt-dark.webp")Charcoal felt for light pieces in dark mode
--felt-texture-sheetfelt var(--felt-texture-light) dark var(--felt-texture-dark)The sheet light pieces are cut from in this mode
--felt-texture-sheet-sizefelt var(--felt-texture-light-size)Its tile size
--felt-texture-sheet-blendfelt multiply dark soft-lightHow the sheet is blended into a piece's colour
--felt-texture-veilfelt 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#

TokenValueUsed for
--felt-patch-shadowfelt 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-domefelt radial-gradient(120% 95% at 35% 10%, rgb(255 255 255 / .2), transparent 60%)The light on a coloured patch's swell
--felt-patch-cutfelt light-dark(#2a1a08, #000)What a patch's cut edge is darkened with
--felt-patch-edge-lightfelt light-dark(#cbbca2, #1d1a17)Cut edge of light patches
--felt-patch-shadow-nearfelt light-dark(rgb(60 40 15 / .26), rgb(0 0 0 / .35))Patches' short cast shadow
--felt-patch-shadow-farfelt light-dark(rgb(60 40 15 / .36), rgb(0 0 0 / .5))Patches' long cast shadow

Grooves and nap#

TokenValueUsed for
--felt-groove-bgfelt 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-shadefelt light-dark(rgb(70 50 20 / .16), rgb(0 0 0 / .45))A groove's shaded top wall
--felt-groove-lipfelt light-dark(rgb(255 255 255 / .35), rgb(255 255 255 / .06))A groove's lit lower lip
--felt-groove-shadowfelt light-dark(rgb(70 50 20 / .25), rgb(0 0 0 / .5))Inset shadow of pressed felt
--felt-groove-shadow-fieldfelt light-dark(rgb(60 40 20 / .08), rgb(0 0 0 / .3))Inset shadow of fields and checks
--felt-nap-highlightfelt light-dark(rgb(255 255 255 / .5), rgb(255 240 220 / .07))Light catching the nap at an edge
--felt-groove-foldfelt 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-yfelt 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-woolfelt #fff4e0Undyed wool: what white pieces (swatches, range thumbs, light dots) are dyed
--felt-wool-knobfelt 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.

TokenValueUsed for
--felt-thread-relieffelt 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-filterfelt 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-creamfelt brightness(.4) sepia(.45) var(--felt-thread-relief)Thread on the lightest felt (cream pieces): a little darker
--felt-thread-filter-patchfelt brightness(1) dark brightness(.9)Thread on coloured patches: a lighter tone of the patch
--felt-thread-filter-inkfelt 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-strengthfelt .72 dark .52How strongly the thread shows on light felt (0–1)
--felt-thread-strength-patchfelt .55 dark .38… on coloured patches
--felt-thread-strength-rowfelt .58Stitch rows dividing a piece, relative to its outer seam
--felt-thread-strength-rulefelt .4hr and .vr
--felt-seam-insetfelt 5pxHow far in from the edge a seam is sewn (cards and other large pieces: 9px)
--felt-stitch-lengthfelt 7pxLength of a stitch in SVG drawings (.stitches)
--felt-stitch-pitchfelt 10pxStitch plus gap
--felt-stitch-shadowfelt 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.