Skip to main content

Customize

CSS variables

felt-css is plain CSS: every colour, radius, space and shadow is a custom property on :root. Override them to make the toolkit yours — no Sass, no build.

View page source on GitHub

Overriding#

All tokens live on :root inside @layer tokens. Any unlayered rule of yours wins over them, so overriding is just redefining:

:root {
  --font: "Atkinson Hyperlegible", system-ui, sans-serif;
  --radius: 6px;
  --container-max: 1200px;
}

Tokens can also be overridden on any element for that part of the page, like Bootstrap's component variables:

Badge
<div style="--primary: var(--moss); --primary-ink: #fff">
  <button type="button" class="btn btn-primary">Moss instead of denim</button>
  <span class="badge text-bg-primary">Badge</span>
</div>

Colors#

Theme colours and their families are described on Color. The neutral tokens:

VariableUsed for
--body-bgPage background
--surfaceCards, list groups, accordions, toasts
--surface-sunkWells, code blocks, tracks
--surface-raisedSlightly raised surfaces: light buttons, .alert-light, .table-light
--surface-overlayDropdowns, popovers, modals, offcanvas — never darker than what they lie on
--surface-hover, --surface-pressedInteraction states of neutral surfaces
--field, --field-addon, --field-disabledInputs, input-group addons, disabled inputs
--border, --border-strongHairlines; outlines that must reach 3:1 (checkboxes, radios)
--text, --emphasisBody text; strongest text
--muted, --subtle-textSecondary and tertiary text
--linkLinks
--focusFocus rings
--trackThe empty part of progress bars
--backdropModal and offcanvas backdrops

Type#

VariableDefault
--fontsystem-ui, -apple-system, "Segoe UI", Roboto, sans-serif
--font-headingvar(--font)
--font-monoui-monospace, SFMono-Regular, Menlo, Consolas, monospace

Spacing, radius and shadows#

VariableDefault
--space-1 … --space-5.25rem, .5rem, 1rem, 1.5rem, 3rem — the same scale as the spacing utilities
--radius-sm, --radius, --radius-lg, --radius-xl, --radius-xxl, --radius-pill6px, 10px, 14px, 20px, 32px, 999px
--shadow-sm, --shadow, --shadow-lgClean-look shadows, darker in dark mode
--container-max1080px

Felt#

The felt look has its own tokens on :root[data-look="felt"]: the felt photos (--felt, --felt-light, --felt-dark and their -size), the sheet everything light is cut from (--sheet, --sheet-blend), edge and shadow tones (--felt-cut, --felt-shadow-near, --felt-shadow-far, …) and the seams (--seam-img, --seam-width, --seam-inset, --seam-filter, --seam-strength). They are tuned together with the images that tools/build_assets.py generates; change the script rather than single values if you want a different stitch.

A cheap tweak that works: --seam-strength (0–1) controls how strongly the thread shows on light felt, --seam-inset how far in from the edge it is sewn.