coverup

Themes

A theme is five colors. Switch with one attribute; everything else (outlines, shadows, ink) is shared.

Built-in themes

Click to preview. The choice is saved in localStorage.

Switching

Two independent attributes on <html>:

AttributeValuesDefault
data-themesunny, sky, mint, lilac, tangerine, or yourssunny
data-modelight, darkfollows the OS
<html lang="en" data-theme="mint" data-mode="dark">

At runtime, both are saved to localStorage:

Coverup.setTheme('lilac');
Coverup.setMode('dark');     // 'light' | 'dark' | 'system'

Add your own theme

Copy src/themes/_template.css, rename brand, set the colors for light and dark, and link it. A theme only sets the ground and accent.

:root[data-theme="brand"] {
  --cu-bg: #f7f8fa;
  --cu-tint: #f1f3f6;
  --cu-rule: #e3e6eb;
  --cu-accent: #ff6b6b;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="brand"]:not([data-mode="light"]) {
    --cu-bg: #23252e; --cu-surface: #2c2f3a; --cu-tint: #343744; --cu-rule: #444858;
    --cu-accent: #ff6b6b;
  }
}
:root[data-theme="brand"][data-mode="dark"] {
  --cu-bg: #23252e; --cu-surface: #2c2f3a; --cu-tint: #343744; --cu-rule: #444858;
  --cu-accent: #ff6b6b;
}

Then <html data-theme="brand">. To show it in the picker, add Coverup.themes.brand = '#ff6b6b'.

Tweak without a theme file

Override tokens after the library CSS to change a single project:

:root { --cu-accent: #ff6b6b; --cu-radius: 0; --cu-offset: 4px; }

Tokens

TokenWhat it does
--cu-bgPage ground
--cu-surfacePanels, inputs, buttons
--cu-tintHover and header fills
--cu-ruleSoft inner dividers
--cu-lineOutlines
--cu-shadowHard offset shadow color
--cu-ink / -soft / -faintText
--cu-accent / --cu-accent-inkAccent and the text on it
--cu-danger / --cu-okStatus colors
--cu-borderOutline width (2px)
--cu-radius / -lgCorner radius
--cu-offset / -lg / -xlShadow distance for buttons, panels, dialogs
--cu-font / --cu-monoFont stacks