Colours
Colour in Shavin has two layers. A gray scale (steps n-0 to n-1000) and one brand colour hold the raw values. Semantic tokens such as bg-surface and text-fg-muted pick from them, and components only use the semantic tokens. That is why changing the gray family, the brand or light and dark mode restyles everything at once.
Gray families
Five gray families ship with Shavin. Each one sets the same steps, from n-0 (white) to n-1000 (black). The values are the same in light and dark mode; what changes is which step each role uses. Pick a family with grayColor on ThemeProvider. Click a swatch to copy its hex.
Which step each role uses
| Token | Light | Dark | Used for |
|---|---|---|---|
--bg-canvas | n-100 | n-950 | Page background |
--bg-surface | n-0 (white) | n-900 | Cards, sidebars, inputs |
--bg-surface-hover | n-100 | n-850 | Hovered rows and controls |
--bg-elevated | n-0 (white) | n-850 | Menus, popovers, dialogs |
--bg-elevated-hover | n-100 | n-800 | Highlighted row inside a menu or select |
--hairline | n-200 | n-800 | Borders and dividers |
--hairline-strong | n-300 | n-700 | Stronger borders, hover outlines |
--border-control | n-450 | n-500 | Input and checkbox borders |
--fg | n-950 | n-200 | Body text and titles |
--fg-muted | n-600 | n-400 | Secondary text |
--fg-subtle | n-500 | n-450 | Captions, placeholders, meta |
Semantic tokens
These are the tokens to use in your own code, as Tailwind classes (bg-surface, text-fg-muted, border-hairline) or as rgb(var(--fg)) in CSS. The swatches show the current theme: switch light and dark mode or the brand and they follow.
Backgrounds
--bg-canvas--bg-surface--bg-surface-hover--bg-elevated--bg-elevated-hoverBorders
--hairline--hairline-strong--border-controlText
--fg--fg-muted--fg-subtle--link--focusBrand
--brand--brand-hover--brand-fg--brand-text--brand-subtleStatus
--success--warning--dangerBrand colour
You give Shavin one brand colour: one of the 24 presets below or any hex. The other brand tokens are worked out from it for light and dark mode, and text, links and focus rings are adjusted until they reach 4.6:1 on every page background. How brand colours stay readable shows it live.
--brand | Your colour. Solid buttons, selected states, toggles. |
--brand-hover | Hover fill for solid brand controls. Keeps the button's text readable. |
--brand-fg | Text and icons on a solid brand fill: white, or near-black when white is under 4.5:1. |
--brand-text, --brand-contrast | Brand-coloured text and icons on the page, at 4.6:1 or more. |
--link, --focus | Links and focus rings. Same value as --brand-text. |
--brand-subtle, --brand-subtle-hover | Tints behind soft buttons and tags: 12% and 18% in light mode, 15% and 22% in dark. |
Status colours
--success, --warning and --danger are fixed colours, not derived from the brand colour. Each has a -fg partner for text on a solid fill, and the light-mode values are darkened so they reach 4.5:1 as text and on their 15% tints.
More brand colours
If your brand has more than one colour, brand tokens turn each extra hex into the same set of contrast-checked tokens.