Part of the jedee wiki — An LLM wiki, written by Claude Code, about the methods and techniques behind this site.

Base color system

On GitHub:

A base color system derives a site’s colors from one color instead of keeping a list of hand-picked values. Change the base and the greys, the accent and the family colors (red, green, blue) all turn with it, the way a type scale is driven by a base size and a ratio.

It works in OKLCH, which splits a color into lightness (l, 0 to 1), colorfulness (c, called chroma) and hue (h, in degrees). Unlike HSL, OKLCH lightness matches what the eye sees: two colors with the same l look equally light whatever their hue. That makes the split useful. The base hands over only its hue and colorfulness; each color role keeps a fixed lightness. Contrast between text and background depends almost entirely on lightness, so a role that keeps its lightness keeps its contrast, whatever base is chosen.

CSS can do the arithmetic itself with relative colors from CSS Color 5: oklch(from var(--color-base) l c h) takes the base apart into l, c and h, and any of them can be replaced or calculated with:

/* The base's hue and a share of its colorfulness, at the role's fixed lightness */
--color-text-muted: oklch(from var(--color-base) 0.517 calc(c * 0.85) h);

All major browsers have supported relative colors since 2024. A browser without them drops the whole declaration, so a system built on them needs plain values for that case.

The parts

  • Two hues, ink and paper. Text, lines and the dark theme’s surfaces take the base’s hue (ink). The light theme’s surfaces take a second hue, a fixed angle away from the base (paper): a cool slate ink on a warm paper reads as printed matter rather than a tinted screen.
  • Angles. The accent and the family colors are fixed angles from the base’s hue, each with a set lightness and colorfulness. Turn the base and they turn the same number of degrees, so they keep their distance from it and from each other.
  • Tint and a cap. The greys take only a share of the base’s colorfulness, and never more than a cap. Without the cap a vivid base turns the whole page into that color.
  • A fixed lightness per role. Each role (page, raised surface, body text, muted text, lines…) has one lightness in light and one in dark. This is the part that makes any base safe to try: the contrast checks were done once, on the lightness, and hold for every hue.

Some colors should not turn at all. A legend means a color stands for something (an activity type on a map); a color picked to match an image names that image’s hue. Those stay fixed.

In jedee

Built 2026-12-04 in five steps (plan: _local/generated/Plan - Base color system.md); Eleventy Excellent has nothing like it, so all of this belongs to jedee. Its color script and colorsBase.json were the starting point: the stock script already makes 100–900 ramps in OKLCH, from one color each.

The settings file. src/_includes/themes/jedee/tokens/colorSystem.json holds every number: the base (#495464, the slate), tint and chromaCap (0.06), paperHue (−151°), the accent (+149.4°, lightness 0.621, colorfulness 0.158) and its text twin, red (+126°), green (−146°) and blue (−15°) with their subdued and vivid shades, the gray and orange ramp steps, the three slate greys, and roles: each lean role’s lightness, share of colorfulness and hue (ink or paper) in light and dark. The Design System page (/design-system/) draws this file as a table of hues and lightness.

Into CSS. The Tailwind plugin writes every setting as a custom property (--color-base, --tint, --chroma-cap, --hue-paper, --l-text-muted-light, --k-text-muted-light …; see Tailwind). variables.css builds the colors from them inside one @supports block:

@supports (color: oklch(from red l c h)) {
  :root {
    --color-bg: light-dark(
      oklch(from var(--color-base) var(--l-bg-light) calc(min(c, var(--chroma-cap)) * var(--tint) * var(--k-bg-light)) calc(h + var(--hue-bg-light))),
      oklch(from var(--color-base) var(--l-bg-dark) calc(min(c, var(--chroma-cap)) * var(--tint) * var(--k-bg-dark)) calc(h + var(--hue-bg-dark)))
    );
  }
}

The ten lean roles, the accent and its text color, the family colors, the gray and orange ramps, the slate greys and the light shadow ink (Shadows) are all written this way. The light-dark() pairs work as described in Dark mode.

The fallback. Outside the @supports block the same names keep plain hex values, worked out at build time from the same file by npm run colors (create-colors.js → colors.json). A browser without relative colors gets today’s colors, not the browser defaults. With the slate base the formulas give back the old hand-picked colors within one step of 255 per channel, which is how steps 1 to 3 were checked: a snapshot of every element’s colors and shadows on five pages in both themes, before and after.

What stays fixed, decided by eye with three other bases (plum, pine, clay): the activity colors with the map’s route line and start dot, which are a legend (The place map), and the cover-tile families, which name each cover’s hue (Duotone). They read --color-fixed-*, listed under fixed in the settings file. The syntax colors stay hand-set (Syntax highlighting), and --color-text-accent stays outside the system for now. The favicon and app icons are image files and change only when npm run favicons runs again.

The copies. The design file can’t run CSS formulas, so src/_config/utils/color-tokens.js works the colors out with colorjs: npm run colors, penpot:tokens, figcraft:tokens and design:md all call it, so the design file and DESIGN.md match the site (Design token sync). A unit test fails when the token files on disk no longer match colorSystem.json. npm run design:system reads the compiled CSS instead, and the four roles whose old-browser value is a color-mix() (bg-low, bg-high, text-muted, text-faint) would drop out of the design system’s color list, since its format can’t read a mix; since 2026-12-04 it takes those four from colorSystem.json through roleColor(). ⚠️ After an edit to colorSystem.json, npm run colors has to run before the build: the fallback hexes come from colors.json, and a stale file still builds without a word, leaving older browsers on the old colors.

Changing the base. Try it first in the tuner on :8090 (the Base color section), which starts from colorSystem.json, overrides only the settings variables so the site’s formulas do the work, stops a move that would push a text pair under 4.5:1, and saves a round as new values for the file. Then set them in colorSystem.json, run npm run colors, and restart the dev server (it keeps the old settings in memory). Check the contrast scan in both themes: at a teal accent the primary button’s light text falls to 2.83:1.

The visitor’s accent. A row of dots in the footer, after Juxtopposed’s VLC redesign, lets a visitor turn the accent to another hue; the greys and the family colors stay with the base. The picker sets --accent-pick, an absolute hue on <html> (plus --accent-pick-l for a hue with a lightness of its own), and variables.css reads it in one place:

--accent-h: var(--accent-pick, calc(h + var(--hue-accent)));
--color-accent-orange: oklch(from var(--color-base) var(--accent-pick-l, var(--l-accent)) var(--c-accent) var(--accent-h));

The accent text color and the orange ramp count from --accent-h as well, so the logomark, link underlines, buttons and everything else on the accent follow. ⚠️ h means something only inside oklch(from …), so --accent-h is used nowhere else. The hues on offer are picker.hues in colorSystem.json; at build time pickerHues() in color-system.js keeps only those that clear 4.5:1 as text and 3:1 as a graphic on every surface where the default accent clears them, and src/_data/accentPicker.js hands the survivors to the templates. A hue can be written as {hue, l} to give the accent (not its text) a lightness of its own. With the slate base the picker offers red (25°), amber (90°, moved from 75° on 2026-12-04 because it sat too close to the orange), green, blue, violet, purple and pink. Green (145°) misses 3:1 as a graphic on the light surfaces at the accent’s 0.621 (2.83:1), so it is set to 0.6, where it clears 3.06:1; teal still misses 4.5:1 as light accent text. The accent text has a lightness for each theme: 0.501 in light, and 0.75 at 90% of the accent’s colorfulness in dark (accent.text.dark, orange-400 at the default). Until 2026-12-04 dark used the accent itself at 0.621, which no hue could get past 4.09:1 on bg-high or 2.92:1 on bg-higher; at 0.75 every offered hue clears 4.5:1 on all four dark surfaces, the lowest being pink at 4.73:1.

bundle/accent-picker.js works like the theme toggle (The theme toggle): inlined in <head>, it reads accent-preference from localStorage and sets the hue before the body renders, so nothing flashes, and it follows a pick made in another open tab. The markup (partials/accent-picker.njk) is a <fieldset> of radio buttons with a visually hidden legend and a name for each hue; the chosen dot gets a ring in the text color, so the choice never rests on color alone. The fieldset ships hidden and the script unhides it only where relative colors work, so without JavaScript, or in an older browser, there is no picker and the default accent stays. Each dot’s tooltip sits on its label, which is why the tooltip selector also matches :has(:focus-visible) (Tooltips). settings.switches.accentPicker turns it off.

Raw source: src/_raw/dev-notes/How the base color system works.md

Keyboard shortcuts

⌘K
Open the search
↓ ↑
Move through the search results
Enter
Open the selected result
Esc
Close the search or this list, or turn off the grid and lines
⌥G
Show or hide the layout grid
⌥R
Show or hide the rhythm lines
⌥L
Open this list