[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M757P71HBFW83CMTDQTTV798":3,"skill-same:01M757P71HBFW83CMTDQTTV798":53},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":29,"commitSha":30,"skillDirectory":31,"forksCount":32,"repositoryHtmlUrl":33,"repositoryHomepageUrl":34,"ownerHtmlUrl":35,"ownerBlogUrl":36,"ownerDescription":37,"updatedAt":38,"install":39,"resources":52},"01M757P71HBFW83CMTDQTTV798","color-and-elevation",null,"Build perceptually-uniform color palettes and physically-consistent depth systems with OKLCH ramps, WCAG\u002FAPCA contrast, semantic tokens, and elevation-as-lightness dark mode — concrete values and copy-pasteable CSS.","jpoindexter\u002FVanta","jpoindexter","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F2729617?v=4","01M72VRRYY1CP7RPF3B7GHH0CR","01M757GWDBT6RD147ZZ79N4MEX",4,"MIT","https:\u002F\u002Fgithub.com\u002Fjpoindexter\u002FVanta\u002Fblob\u002Fmain\u002Fdesign-system-skills\u002Fcolor-and-elevation\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: color-and-elevation\ndescription: Build perceptually-uniform color palettes and physically-consistent depth systems with OKLCH ramps, WCAG\u002FAPCA contrast, semantic tokens, and elevation-as-lightness dark mode — concrete values and copy-pasteable CSS.\ntags: [design-systems, color, contrast, dark-mode, elevation]\n---\n# Color & Elevation Systems\n\nA design system's color and depth layers must be **perceptually engineered**, not hand-picked. This skill gives the math, the tokens, and the CSS to ship palettes that stay accessible across light\u002Fdark, sRGB\u002FP3, and every screen.\n\n## 1. Color models — what each is for\n\n| Model | Axes | Strength | Fatal flaw | Use for |\n|-------|------|----------|-----------|---------|\n| **HEX \u002F RGB** | r,g,b | Universal, gamut-true | Not human-legible; no perceptual ops | Storage, final output |\n| **HSL \u002F HSV** | h,s,l\u002Fv | Easy mental model | **L is not perceptual** — `hsl(60 100% 50%)` (yellow) and `hsl(240 100% 50%)` (blue) both \"50%\" but yellow is ~6× brighter | Quick tweaks only — never for ramps |\n| **LCH \u002F Lab** (CIE) | L,C,h | Perceptually uniform | Hue shifts (blue→purple) on lightness change | Print, legacy perceptual work |\n| **OKLCH \u002F OKLab** | L,C,h | **Perceptually uniform, no hue shift, predictable** | Newer; needs fallback for old browsers | **Palette generation, the default** |\n\n**Why OKLCH wins for palettes:** equal steps in `L` look equally spaced to the eye, and changing `L` or `C` does *not* drift the hue. HSL's `lightness` lies — that is the #1 cause of muddy, uneven ramps. Author in OKLCH, ship HEX\u002FRGB fallbacks.\n\n```css\n\u002F* Same hue, even perceptual lightness steps — looks like a real ramp *\u002F\n--blue-300: oklch(0.78 0.12 250);\n--blue-500: oklch(0.62 0.16 250);\n--blue-700: oklch(0.46 0.14 250);\n```\n\n### Gamut: sRGB vs Display-P3\n- **sRGB** — the safe floor; every device renders it.\n- **Display-P3** — ~25% wider, covers vivid greens\u002Freds modern phones\u002Flaptops show. Author accent colors with a P3 boost, fall back to sRGB.\n\n```css\n--brand: #4f46e5;                                   \u002F* sRGB fallback *\u002F\n@supports (color: color(display-p3 1 1 1)) {\n  --brand: oklch(0.52 0.21 274);                    \u002F* richer on P3 screens *\u002F\n}\n```\nBrowsers clamp out-of-gamut OKLCH back into the device gamut automatically, so OKLCH authoring is gamut-safe by default.\n\n## 2. Building a palette — three layers\n\nTokens flow **primitive → semantic → component**. Never let a component reference a primitive directly.\n\n**1. Primitive ramps (raw, 50–950).** One ramp per hue family + a neutral ramp. 11 steps. Generate by holding `C`\u002F`h` roughly constant and stepping `L` evenly in OKLCH.\n\n```css\n:root {\n  --gray-50:  oklch(0.985 0.002 250);\n  --gray-100: oklch(0.967 0.003 250);\n  --gray-200: oklch(0.928 0.006 250);\n  --gray-300: oklch(0.872 0.010 250);\n  --gray-400: oklch(0.715 0.014 250);\n  --gray-500: oklch(0.555 0.016 250);\n  --gray-600: oklch(0.446 0.015 250);\n  --gray-700: oklch(0.372 0.013 250);\n  --gray-800: oklch(0.279 0.010 250);\n  --gray-900: oklch(0.208 0.008 250);\n  --gray-950: oklch(0.145 0.006 250);\n}\n```\n> Note the **slightly higher chroma at the dark end** for neutrals — a hint of blue keeps near-blacks from looking dead. Pure-gray neutrals read clinical.\n\n**2. Semantic tokens (roles, not values).** This is the layer screens consume. Names describe *purpose*, so they can flip per theme.\n\n```css\n:root {\n  --color-bg:            var(--gray-50);\n  --color-surface:       #ffffff;\n  --color-surface-raised:#ffffff;\n  --color-text:          var(--gray-900);\n  --color-text-muted:    var(--gray-600);\n  --color-text-subtle:   var(--gray-500);\n  --color-border:        var(--gray-200);\n  --color-border-strong: var(--gray-300);\n\n  --color-primary:       var(--blue-600);\n  --color-primary-hover: var(--blue-700);\n  --color-on-primary:    #ffffff;\n\n  --color-success: oklch(0.62 0.15 150);\n  --color-warning: oklch(0.75 0.15 80);\n  --color-danger:  oklch(0.58 0.20 27);\n  --color-info:    oklch(0.62 0.14 240);\n}\n```\n\n**3. Component tokens (optional 3rd tier).** Only when a component needs to diverge: `--button-primary-bg: var(--color-primary)`. Rule of 3 — don't create this layer until a real component needs to override a semantic value.\n\n**Color roles:** every system needs **brand** (1 hue, identity), **neutral** (1 ramp, ~90% of the UI), and **accent\u002Ffunctional** (success\u002Fwarning\u002Fdanger\u002Finfo + maybe 1 secondary). Resist a rainbow — most great UIs are one brand hue + grays.\n\n### Generating accessible ramps — the recipe\n1. Pick hue `h` and a peak chroma `C` for the family.\n2. Set `L` per step from a fixed table (below) — these are perceptual, reusable across hues.\n3. **Taper chroma at the extremes** (`50` and `950`) so light tints and dark shades don't oversaturate.\n4. Verify each step's contrast against its likely background (§3).\n\n| Step | OKLCH L | Typical role |\n|------|---------|--------------|\n| 50 | 0.97 | faint tint bg |\n| 100 | 0.94 | hover tint |\n| 200 | 0.88 | subtle border |\n| 300 | 0.80 | border |\n| 400 | 0.70 | disabled\u002Ficon |\n| 500 | 0.62 | base \u002F large text on white |\n| 600 | 0.54 | **body text floor on white (~4.5:1)** |\n| 700 | 0.46 | strong text, pressed |\n| 800 | 0.36 | headings |\n| 900 | 0.26 | max text |\n| 950 | 0.16 | near-black surface |\n\n## 3. Contrast & accessibility\n\n**WCAG 2.2 (legal\u002Fstandard baseline):**\n\n| Content | AA | AAA |\n|---------|-----|-----|\n| Normal text (\u003C18px \u002F \u003C14px bold) | **4.5:1** | 7:1 |\n| Large text (≥24px \u002F ≥18.66px bold) | **3:1** | 4.5:1 |\n| UI components, focus rings, graphics, icons | **3:1** | — |\n\n- **Never encode meaning in color alone** (1.4.1) — pair red\u002Fgreen with an icon, label, or shape. ~8% of men have a color-vision deficiency.\n- Disabled controls are exempt from contrast, but don't hide essential info in them.\n- Contrast is the **single highest-leverage accessibility lever** — fix it first.\n\n**APCA (the modern method, future WCAG 3):** WCAG 2.x's ratio is a crude 1970s formula — it *over*-passes light-gray-on-white and *under*-passes some dark pairings. **APCA** models real human contrast perception (accounts for text size, weight, and polarity — dark-on-light vs light-on-dark differ). It outputs an **Lc value** (~0–106), not a ratio. Rough targets: **Lc 90** body text, **Lc 75** larger\u002Fheadings, **Lc 60** large\u002Fnon-text, **Lc 45** disabled\u002Fdecorative. Status (2024–2026): still a **W3C draft**, not yet legally required — **ship to WCAG 2.2 AA for compliance, use APCA to make borderline grays actually readable.** Tools: `apcacontrast.com`, the APCA Figma plugin.\n\n```css\n\u002F* Common failure: looks fine, fails AA. gray-400 on white ≈ 2.9:1 *\u002F\n.bad  { color: var(--gray-400); }   \u002F* ✗ body text *\u002F\n\u002F* gray-600 on white ≈ 4.6:1 — passes AA for body *\u002F\n.good { color: var(--gray-600); }   \u002F* ✓ *\u002F\n```\n\n## 4. Dark mode — not an invert\n\nInverting a light theme produces harsh, vibrating, eye-straining UI. Dark mode is its own design:\n\n- **Dimmed \"white\" text** — use `#e6e6e6`–`#d4d4d4` (`oklch(~0.92)`), never `#fff`. Pure white on dark vibrates and induces halation, worse for astigmatism.\n- **Never pure-black `#000` backgrounds** — use `oklch(0.16–0.21)` (`~#121212`–`#1a1a1a`). Pure black maxes contrast (uncomfortable), kills elevation cues, and smears on OLED.\n- **Desaturate accents** — high-chroma colors glare on dark. Drop chroma ~15–30% and nudge lightness up.\n- **Reduce overall contrast** — aim for comfortable, not maximal. ~`Lc 90`\u002F15.8:1, not 21:1.\n- **Elevation = lighter surface, not bigger shadow** (shadows barely read on dark). Higher layers get lighter.\n\n```css\n:root { color-scheme: light dark; }\n@media (prefers-color-scheme: dark) {\n  :root {\n    --color-bg:             oklch(0.16 0.006 250);   \u002F* not #000 *\u002F\n    --color-surface:        oklch(0.21 0.007 250);\n    --color-surface-raised: oklch(0.25 0.008 250);   \u002F* higher = lighter *\u002F\n    --color-text:           oklch(0.92 0.004 250);   \u002F* not #fff *\u002F\n    --color-text-muted:     oklch(0.72 0.006 250);\n    --color-border:         oklch(0.30 0.008 250);\n    --color-primary:        oklch(0.70 0.13 250);     \u002F* lighter + desaturated *\u002F\n    --color-on-primary:     oklch(0.18 0.01 250);\n  }\n}\n```\n\n**`light-dark()` (2024+, baseline-supported)** — one declaration, both themes, no media query:\n\n```css\n:root { color-scheme: light dark; }\n.card {\n  background: light-dark(#ffffff, oklch(0.21 0.007 250));\n  color:      light-dark(var(--gray-900), oklch(0.92 0.004 250));\n}\n```\nFor a user toggle, set `color-scheme: light` \u002F `dark` on `:root` via a class or `[data-theme]` and `light-dark()` follows it.\n\n**Surface tint:** in dark mode, mixing a few % of the brand hue into surfaces (Material's \"tonal elevation\") makes layers cohere. `background: color-mix(in oklab, var(--color-surface), var(--color-primary) 5%);`\n\n## 5. Elevation & depth\n\nDepth comes from **shadow** (light mode) and **surface lightness** (dark mode), kept physically consistent.\n\n### Realistic shadows = layered + ambient\nA single `box-shadow` looks like a sticker. Real shadows stack a tight **direct\u002Fkey** shadow (close, sharp) under a soft **ambient** shadow (far, diffuse), and shadow opacity grows with elevation while staying low (4–18%).\n\n```css\n:root {\n  \u002F* layered: ambient (soft, low) + direct (tight, slightly darker) *\u002F\n  --shadow-xs: 0 1px 2px rgb(0 0 0 \u002F 0.05);\n  --shadow-sm: 0 1px 2px rgb(0 0 0 \u002F 0.06), 0 1px 3px rgb(0 0 0 \u002F 0.10);\n  --shadow-md: 0 2px 4px rgb(0 0 0 \u002F 0.06), 0 4px 8px rgb(0 0 0 \u002F 0.10);\n  --shadow-lg: 0 4px 8px rgb(0 0 0 \u002F 0.06), 0 12px 24px rgb(0 0 0 \u002F 0.12);\n  --shadow-xl: 0 8px 16px rgb(0 0 0 \u002F 0.08), 0 24px 48px rgb(0 0 0 \u002F 0.16);\n}\n```\n\n### Elevation tokens (Material 0–24 → practical 6-step)\nMap abstract elevation to a token; assign each UI layer once: `0` base, `1` card, `2` raised card\u002Fdropdown trigger, `3` dropdown\u002Fmenu, `4` modal\u002Fdialog, `5` toast\u002Fpopover. Tie elevation to a **z-index scale** so stacking never collides:\n\n```css\n:root {\n  --z-base: 0; --z-dropdown: 1000; --z-sticky: 1100;\n  --z-overlay: 1200; --z-modal: 1300; --z-toast: 1400; --z-tooltip: 1500;\n}\n```\n> Keep z-index on a named scale with gaps (×100). Random `z-index: 9999` is the root of all stacking bugs.\n\n**Light-source consistency:** pick one light direction (top, slightly front) and keep it for *every* shadow — all `y` offsets positive, blur grows with distance. Inconsistent offsets read as broken depth. Inset shadows (pressed\u002Finputs) flip this intentionally.\n\n**Borders vs shadows:** shadows imply *float*; borders imply *containment on the same plane*. On dark UIs and at low elevation, a 1px border (or a hairline + tiny shadow) reads cleaner than a shadow alone. High-contrast\u002FWindows-forced-colors users lose shadows entirely — never make a shadow the *only* affordance.\n\n**Glassmorphism \u002F blur:**\n```css\n.glass {\n  background: color-mix(in oklab, white 60%, transparent);\n  backdrop-filter: blur(12px) saturate(1.4);\n  border: 1px solid rgb(255 255 255 \u002F 0.2);   \u002F* edge defines the pane *\u002F\n}\n```\nAlways provide a solid fallback (`@supports not (backdrop-filter: blur(1px))`) — blur tanks scroll perf on weak GPUs and fails behind busy backgrounds.\n\n## 6. Color theory essentials\n\n- **Harmony:** complementary (opposite hues — high tension, sparingly for accents), analogous (adjacent — calm, cohesive), triadic (3 evenly spaced — vibrant, balance one as dominant).\n- **Temperature:** warm (red→yellow) advances\u002Fenergizes; cool (blue→green) recedes\u002Fcalms. Warm-tinted neutrals feel inviting; cool-tinted feel technical.\n- **Saturation strategy:** desaturate large areas, save high chroma for small focal elements (CTAs, badges). Big saturated fills fatigue the eye.\n- **60-30-10:** ~60% dominant (neutral bg), 30% secondary (surfaces), 10% accent (brand\u002FCTA). Keeps hierarchy clean.\n- **Semantic conventions:** red = danger\u002Ferror\u002Fstop, green = success\u002Fgo, yellow\u002Famber = warning, blue = info\u002Fneutral-action. **Cultural caveat:** red = luck\u002Fcelebration in China, mourning elsewhere; green has religious meaning in some regions; in finance red\u002Fgreen can invert by market. Don't rely on convention alone — pair with icon + text (loops back to §3).\n\n## 7. Tokens, theming, gradients\n\n**JSON design tokens** (W3C-aligned, feeds Style Dictionary \u002F Tokens Studio):\n```json\n{\n  \"color\": {\n    \"primary\": { \"$type\": \"color\", \"$value\": \"oklch(0.54 0.16 250)\" },\n    \"text\":    { \"$type\": \"color\", \"$value\": \"{color.gray.900}\" }\n  },\n  \"elevation\": {\n    \"md\": { \"$type\": \"shadow\", \"$value\": \"0 2px 4px #0000000f, 0 4px 8px #0000001a\" }\n  }\n}\n```\n\n**Multi-brand theming** — keep *semantic* names identical, swap the *values* per `[data-theme]`. Components never change:\n```css\n[data-theme=\"acme\"]  { --color-primary: oklch(0.55 0.18 265); }\n[data-theme=\"globex\"]{ --color-primary: oklch(0.60 0.14 160); }\n```\n\n**`color-mix()`** generates states without new tokens — hovers, tints, overlays:\n```css\n--primary-hover: color-mix(in oklab, var(--color-primary), black 12%);\n--primary-tint:  color-mix(in oklab, var(--color-primary) 8%, var(--color-surface));\n```\n> Mix in **`oklab`\u002F`oklch`**, not `srgb` — sRGB mixing muddies through gray (e.g. blue→yellow passes through dirty olive).\n\n**Relative color syntax (2024+)** — derive from one source color:\n```css\n--primary-light: oklch(from var(--color-primary) calc(l + 0.12) c h);\n--primary-faded: oklch(from var(--color-primary) l calc(c * 0.5) h);\n```\n\n**Gradients — avoid banding & gray dead-zones:**\n```css\n\u002F* Interpolate in oklab so the midpoint stays vivid, not muddy *\u002F\nbackground: linear-gradient(in oklab, oklch(0.6 0.2 280), oklch(0.7 0.18 200));\n```\n- Banding (visible stripes) shows on large\u002Flow-contrast gradients on 8-bit panels. Fix: add a faint SVG\u002FPNG noise overlay (`opacity: 0.02–0.04`) to **dither**, or keep gradients shorter.\n- Always interpolate perceptually (`in oklab`\u002F`in oklch`) — default sRGB interpolation darkens and desaturates the middle.\n\n## Common mistakes (quick reference)\n\n| ✗ Mistake | ✓ Fix |\n|-----------|-------|\n| Building ramps in HSL with even L steps | Use OKLCH — HSL lightness is perceptually uneven |\n| `gray-400` for body text on white (~2.9:1) | `gray-600`+ for AA; verify, don't eyeball |\n| Pure `#000` dark bg + pure `#fff` text | `oklch(0.16)` bg, `oklch(0.92)` text |\n| Full-chroma accents in dark mode | Desaturate ~20%, lighten slightly |\n| Single flat `box-shadow` | Layer ambient + direct shadows |\n| Shadow as the only depth\u002Faffordance cue | Add border \u002F surface-lightness; survives forced-colors |\n| Components point at primitives (`--blue-600`) | Route through semantic tokens so themes flip |\n| `color-mix`\u002Fgradients in sRGB | Mix and interpolate `in oklab` |\n| Random `z-index: 9999` | Named z-scale with gaps |\n| Color-only status (red\u002Fgreen dot) | Color + icon + text label |\n\n**Ship order:** OKLCH primitive ramps → semantic tokens → contrast-check every text\u002Fbg pair (AA, APCA for grays) → dark theme via `light-dark()` + lighter surfaces → layered shadows on a z-scale → P3 boost last.\n","# Color & Elevation Systems\n\nA design system's color and depth layers must be **perceptually engineered**, not hand-picked. This skill gives the math, the tokens, and the CSS to ship palettes that stay accessible across light\u002Fdark, sRGB\u002FP3, and every screen.\n\n## 1. Color models — what each is for\n\n| Model | Axes | Strength | Fatal flaw | Use for |\n|-------|------|----------|-----------|---------|\n| **HEX \u002F RGB** | r,g,b | Universal, gamut-true | Not human-legible; no perceptual ops | Storage, final output |\n| **HSL \u002F HSV** | h,s,l\u002Fv | Easy mental model | **L is not perceptual** — `hsl(60 100% 50%)` (yellow) and `hsl(240 100% 50%)` (blue) both \"50%\" but yellow is ~6× brighter | Quick tweaks only — never for ramps |\n| **LCH \u002F Lab** (CIE) | L,C,h | Perceptually uniform | Hue shifts (blue→purple) on lightness change | Print, legacy perceptual work |\n| **OKLCH \u002F OKLab** | L,C,h | **Perceptually uniform, no hue shift, predictable** | Newer; needs fallback for old browsers | **Palette generation, the default** |\n\n**Why OKLCH wins for palettes:** equal steps in `L` look equally spaced to the eye, and changing `L` or `C` does *not* drift the hue. HSL's `lightness` lies — that is the #1 cause of muddy, uneven ramps. Author in OKLCH, ship HEX\u002FRGB fallbacks.\n\n```css\n\u002F* Same hue, even perceptual lightness steps — looks like a real ramp *\u002F\n--blue-300: oklch(0.78 0.12 250);\n--blue-500: oklch(0.62 0.16 250);\n--blue-700: oklch(0.46 0.14 250);\n```\n\n### Gamut: sRGB vs Display-P3\n- **sRGB** — the safe floor; every device renders it.\n- **Display-P3** — ~25% wider, covers vivid greens\u002Freds modern phones\u002Flaptops show. Author accent colors with a P3 boost, fall back to sRGB.\n\n```css\n--brand: #4f46e5;                                   \u002F* sRGB fallback *\u002F\n@supports (color: color(display-p3 1 1 1)) {\n  --brand: oklch(0.52 0.21 274);                    \u002F* richer on P3 screens *\u002F\n}\n```\nBrowsers clamp out-of-gamut OKLCH back into the device gamut automatically, so OKLCH authoring is gamut-safe by default.\n\n## 2. Building a palette — three layers\n\nTokens flow **primitive → semantic → component**. Never let a component reference a primitive directly.\n\n**1. Primitive ramps (raw, 50–950).** One ramp per hue family + a neutral ramp. 11 steps. Generate by holding `C`\u002F`h` roughly constant and stepping `L` evenly in OKLCH.\n\n```css\n:root {\n  --gray-50:  oklch(0.985 0.002 250);\n  --gray-100: oklch(0.967 0.003 250);\n  --gray-200: oklch(0.928 0.006 250);\n  --gray-300: oklch(0.872 0.010 250);\n  --gray-400: oklch(0.715 0.014 250);\n  --gray-500: oklch(0.555 0.016 250);\n  --gray-600: oklch(0.446 0.015 250);\n  --gray-700: oklch(0.372 0.013 250);\n  --gray-800: oklch(0.279 0.010 250);\n  --gray-900: oklch(0.208 0.008 250);\n  --gray-950: oklch(0.145 0.006 250);\n}\n```\n> Note the **slightly higher chroma at the dark end** for neutrals — a hint of blue keeps near-blacks from looking dead. Pure-gray neutrals read clinical.\n\n**2. Semantic tokens (roles, not values).** This is the layer screens consume. Names describe *purpose*, so they can flip per theme.\n\n```css\n:root {\n  --color-bg:            var(--gray-50);\n  --color-surface:       #ffffff;\n  --color-surface-raised:#ffffff;\n  --color-text:          var(--gray-900);\n  --color-text-muted:    var(--gray-600);\n  --color-text-subtle:   var(--gray-500);\n  --color-border:        var(--gray-200);\n  --color-border-strong: var(--gray-300);\n\n  --color-primary:       var(--blue-600);\n  --color-primary-hover: var(--blue-700);\n  --color-on-primary:    #ffffff;\n\n  --color-success: oklch(0.62 0.15 150);\n  --color-warning: oklch(0.75 0.15 80);\n  --color-danger:  oklch(0.58 0.20 27);\n  --color-info:    oklch(0.62 0.14 240);\n}\n```\n\n**3. Component tokens (optional 3rd tier).** Only when a component needs to diverge: `--button-primary-bg: var(--color-primary)`. Rule of 3 — don't create this layer until a real component needs to override a semantic value.\n\n**Color roles:** every system needs **brand** (1 hue, identity), **neutral** (1 ramp, ~90% of the UI), and **accent\u002Ffunctional** (success\u002Fwarning\u002Fdanger\u002Finfo + maybe 1 secondary). Resist a rainbow — most great UIs are one brand hue + grays.\n\n### Generating accessible ramps — the recipe\n1. Pick hue `h` and a peak chroma `C` for the family.\n2. Set `L` per step from a fixed table (below) — these are perceptual, reusable across hues.\n3. **Taper chroma at the extremes** (`50` and `950`) so light tints and dark shades don't oversaturate.\n4. Verify each step's contrast against its likely background (§3).\n\n| Step | OKLCH L | Typical role |\n|------|---------|--------------|\n| 50 | 0.97 | faint tint bg |\n| 100 | 0.94 | hover tint |\n| 200 | 0.88 | subtle border |\n| 300 | 0.80 | border |\n| 400 | 0.70 | disabled\u002Ficon |\n| 500 | 0.62 | base \u002F large text on white |\n| 600 | 0.54 | **body text floor on white (~4.5:1)** |\n| 700 | 0.46 | strong text, pressed |\n| 800 | 0.36 | headings |\n| 900 | 0.26 | max text |\n| 950 | 0.16 | near-black surface |\n\n## 3. Contrast & accessibility\n\n**WCAG 2.2 (legal\u002Fstandard baseline):**\n\n| Content | AA | AAA |\n|---------|-----|-----|\n| Normal text (\u003C18px \u002F \u003C14px bold) | **4.5:1** | 7:1 |\n| Large text (≥24px \u002F ≥18.66px bold) | **3:1** | 4.5:1 |\n| UI components, focus rings, graphics, icons | **3:1** | — |\n\n- **Never encode meaning in color alone** (1.4.1) — pair red\u002Fgreen with an icon, label, or shape. ~8% of men have a color-vision deficiency.\n- Disabled controls are exempt from contrast, but don't hide essential info in them.\n- Contrast is the **single highest-leverage accessibility lever** — fix it first.\n\n**APCA (the modern method, future WCAG 3):** WCAG 2.x's ratio is a crude 1970s formula — it *over*-passes light-gray-on-white and *under*-passes some dark pairings. **APCA** models real human contrast perception (accounts for text size, weight, and polarity — dark-on-light vs light-on-dark differ). It outputs an **Lc value** (~0–106), not a ratio. Rough targets: **Lc 90** body text, **Lc 75** larger\u002Fheadings, **Lc 60** large\u002Fnon-text, **Lc 45** disabled\u002Fdecorative. Status (2024–2026): still a **W3C draft**, not yet legally required — **ship to WCAG 2.2 AA for compliance, use APCA to make borderline grays actually readable.** Tools: `apcacontrast.com`, the APCA Figma plugin.\n\n```css\n\u002F* Common failure: looks fine, fails AA. gray-400 on white ≈ 2.9:1 *\u002F\n.bad  { color: var(--gray-400); }   \u002F* ✗ body text *\u002F\n\u002F* gray-600 on white ≈ 4.6:1 — passes AA for body *\u002F\n.good { color: var(--gray-600); }   \u002F* ✓ *\u002F\n```\n\n## 4. Dark mode — not an invert\n\nInverting a light theme produces harsh, vibrating, eye-straining UI. Dark mode is its own design:\n\n- **Dimmed \"white\" text** — use `#e6e6e6`–`#d4d4d4` (`oklch(~0.92)`), never `#fff`. Pure white on dark vibrates and induces halation, worse for astigmatism.\n- **Never pure-black `#000` backgrounds** — use `oklch(0.16–0.21)` (`~#121212`–`#1a1a1a`). Pure black maxes contrast (uncomfortable), kills elevation cues, and smears on OLED.\n- **Desaturate accents** — high-chroma colors glare on dark. Drop chroma ~15–30% and nudge lightness up.\n- **Reduce overall contrast** — aim for comfortable, not maximal. ~`Lc 90`\u002F15.8:1, not 21:1.\n- **Elevation = lighter surface, not bigger shadow** (shadows barely read on dark). Higher layers get lighter.\n\n```css\n:root { color-scheme: light dark; }\n@media (prefers-color-scheme: dark) {\n  :root {\n    --color-bg:             oklch(0.16 0.006 250);   \u002F* not #000 *\u002F\n    --color-surface:        oklch(0.21 0.007 250);\n    --color-surface-raised: oklch(0.25 0.008 250);   \u002F* higher = lighter *\u002F\n    --color-text:           oklch(0.92 0.004 250);   \u002F* not #fff *\u002F\n    --color-text-muted:     oklch(0.72 0.006 250);\n    --color-border:         oklch(0.30 0.008 250);\n    --color-primary:        oklch(0.70 0.13 250);     \u002F* lighter + desaturated *\u002F\n    --color-on-primary:     oklch(0.18 0.01 250);\n  }\n}\n```\n\n**`light-dark()` (2024+, baseline-supported)** — one declaration, both themes, no media query:\n\n```css\n:root { color-scheme: light dark; }\n.card {\n  background: light-dark(#ffffff, oklch(0.21 0.007 250));\n  color:      light-dark(var(--gray-900), oklch(0.92 0.004 250));\n}\n```\nFor a user toggle, set `color-scheme: light` \u002F `dark` on `:root` via a class or `[data-theme]` and `light-dark()` follows it.\n\n**Surface tint:** in dark mode, mixing a few % of the brand hue into surfaces (Material's \"tonal elevation\") makes layers cohere. `background: color-mix(in oklab, var(--color-surface), var(--color-primary) 5%);`\n\n## 5. Elevation & depth\n\nDepth comes from **shadow** (light mode) and **surface lightness** (dark mode), kept physically consistent.\n\n### Realistic shadows = layered + ambient\nA single `box-shadow` looks like a sticker. Real shadows stack a tight **direct\u002Fkey** shadow (close, sharp) under a soft **ambient** shadow (far, diffuse), and shadow opacity grows with elevation while staying low (4–18%).\n\n```css\n:root {\n  \u002F* layered: ambient (soft, low) + direct (tight, slightly darker) *\u002F\n  --shadow-xs: 0 1px 2px rgb(0 0 0 \u002F 0.05);\n  --shadow-sm: 0 1px 2px rgb(0 0 0 \u002F 0.06), 0 1px 3px rgb(0 0 0 \u002F 0.10);\n  --shadow-md: 0 2px 4px rgb(0 0 0 \u002F 0.06), 0 4px 8px rgb(0 0 0 \u002F 0.10);\n  --shadow-lg: 0 4px 8px rgb(0 0 0 \u002F 0.06), 0 12px 24px rgb(0 0 0 \u002F 0.12);\n  --shadow-xl: 0 8px 16px rgb(0 0 0 \u002F 0.08), 0 24px 48px rgb(0 0 0 \u002F 0.16);\n}\n```\n\n### Elevation tokens (Material 0–24 → practical 6-step)\nMap abstract elevation to a token; assign each UI layer once: `0` base, `1` card, `2` raised card\u002Fdropdown trigger, `3` dropdown\u002Fmenu, `4` modal\u002Fdialog, `5` toast\u002Fpopover. Tie elevation to a **z-index scale** so stacking never collides:\n\n```css\n:root {\n  --z-base: 0; --z-dropdown: 1000; --z-sticky: 1100;\n  --z-overlay: 1200; --z-modal: 1300; --z-toast: 1400; --z-tooltip: 1500;\n}\n```\n> Keep z-index on a named scale with gaps (×100). Random `z-index: 9999` is the root of all stacking bugs.\n\n**Light-source consistency:** pick one light direction (top, slightly front) and keep it for *every* shadow — all `y` offsets positive, blur grows with distance. Inconsistent offsets read as broken depth. Inset shadows (pressed\u002Finputs) flip this intentionally.\n\n**Borders vs shadows:** shadows imply *float*; borders imply *containment on the same plane*. On dark UIs and at low elevation, a 1px border (or a hairline + tiny shadow) reads cleaner than a shadow alone. High-contrast\u002FWindows-forced-colors users lose shadows entirely — never make a shadow the *only* affordance.\n\n**Glassmorphism \u002F blur:**\n```css\n.glass {\n  background: color-mix(in oklab, white 60%, transparent);\n  backdrop-filter: blur(12px) saturate(1.4);\n  border: 1px solid rgb(255 255 255 \u002F 0.2);   \u002F* edge defines the pane *\u002F\n}\n```\nAlways provide a solid fallback (`@supports not (backdrop-filter: blur(1px))`) — blur tanks scroll perf on weak GPUs and fails behind busy backgrounds.\n\n## 6. Color theory essentials\n\n- **Harmony:** complementary (opposite hues — high tension, sparingly for accents), analogous (adjacent — calm, cohesive), triadic (3 evenly spaced — vibrant, balance one as dominant).\n- **Temperature:** warm (red→yellow) advances\u002Fenergizes; cool (blue→green) recedes\u002Fcalms. Warm-tinted neutrals feel inviting; cool-tinted feel technical.\n- **Saturation strategy:** desaturate large areas, save high chroma for small focal elements (CTAs, badges). Big saturated fills fatigue the eye.\n- **60-30-10:** ~60% dominant (neutral bg), 30% secondary (surfaces), 10% accent (brand\u002FCTA). Keeps hierarchy clean.\n- **Semantic conventions:** red = danger\u002Ferror\u002Fstop, green = success\u002Fgo, yellow\u002Famber = warning, blue = info\u002Fneutral-action. **Cultural caveat:** red = luck\u002Fcelebration in China, mourning elsewhere; green has religious meaning in some regions; in finance red\u002Fgreen can invert by market. Don't rely on convention alone — pair with icon + text (loops back to §3).\n\n## 7. Tokens, theming, gradients\n\n**JSON design tokens** (W3C-aligned, feeds Style Dictionary \u002F Tokens Studio):\n```json\n{\n  \"color\": {\n    \"primary\": { \"$type\": \"color\", \"$value\": \"oklch(0.54 0.16 250)\" },\n    \"text\":    { \"$type\": \"color\", \"$value\": \"{color.gray.900}\" }\n  },\n  \"elevation\": {\n    \"md\": { \"$type\": \"shadow\", \"$value\": \"0 2px 4px #0000000f, 0 4px 8px #0000001a\" }\n  }\n}\n```\n\n**Multi-brand theming** — keep *semantic* names identical, swap the *values* per `[data-theme]`. Components never change:\n```css\n[data-theme=\"acme\"]  { --color-primary: oklch(0.55 0.18 265); }\n[data-theme=\"globex\"]{ --color-primary: oklch(0.60 0.14 160); }\n```\n\n**`color-mix()`** generates states without new tokens — hovers, tints, overlays:\n```css\n--primary-hover: color-mix(in oklab, var(--color-primary), black 12%);\n--primary-tint:  color-mix(in oklab, var(--color-primary) 8%, var(--color-surface));\n```\n> Mix in **`oklab`\u002F`oklch`**, not `srgb` — sRGB mixing muddies through gray (e.g. blue→yellow passes through dirty olive).\n\n**Relative color syntax (2024+)** — derive from one source color:\n```css\n--primary-light: oklch(from var(--color-primary) calc(l + 0.12) c h);\n--primary-faded: oklch(from var(--color-primary) l calc(c * 0.5) h);\n```\n\n**Gradients — avoid banding & gray dead-zones:**\n```css\n\u002F* Interpolate in oklab so the midpoint stays vivid, not muddy *\u002F\nbackground: linear-gradient(in oklab, oklch(0.6 0.2 280), oklch(0.7 0.18 200));\n```\n- Banding (visible stripes) shows on large\u002Flow-contrast gradients on 8-bit panels. Fix: add a faint SVG\u002FPNG noise overlay (`opacity: 0.02–0.04`) to **dither**, or keep gradients shorter.\n- Always interpolate perceptually (`in oklab`\u002F`in oklch`) — default sRGB interpolation darkens and desaturates the middle.\n\n## Common mistakes (quick reference)\n\n| ✗ Mistake | ✓ Fix |\n|-----------|-------|\n| Building ramps in HSL with even L steps | Use OKLCH — HSL lightness is perceptually uneven |\n| `gray-400` for body text on white (~2.9:1) | `gray-600`+ for AA; verify, don't eyeball |\n| Pure `#000` dark bg + pure `#fff` text | `oklch(0.16)` bg, `oklch(0.92)` text |\n| Full-chroma accents in dark mode | Desaturate ~20%, lighten slightly |\n| Single flat `box-shadow` | Layer ambient + direct shadows |\n| Shadow as the only depth\u002Faffordance cue | Add border \u002F surface-lightness; survives forced-colors |\n| Components point at primitives (`--blue-600`) | Route through semantic tokens so themes flip |\n| `color-mix`\u002Fgradients in sRGB | Mix and interpolate `in oklab` |\n| Random `z-index: 9999` | Named z-scale with gaps |\n| Color-only status (red\u002Fgreen dot) | Color + icon + text label |\n\n**Ship order:** OKLCH primitive ramps → semantic tokens → contrast-check every text\u002Fbg pair (AA, APCA for grays) → dark theme via `light-dark()` + lighter surfaces → layered shadows on a z-scale → P3 boost last.\n",{"name":5,"tags":23,"description":7},[24,25,26,27,28],"design-systems","color","contrast","dark-mode","elevation","main","4911ae44bbb35beef4511ba298475ba5a82b7e1c","design-system-skills\u002Fcolor-and-elevation",0,"https:\u002F\u002Fgithub.com\u002Fjpoindexter\u002FVanta","https:\u002F\u002Fdocs.vanta.theft.studio","https:\u002F\u002Fgithub.com\u002Fjpoindexter","jason.theft.studio","Just some guy trying to build stuff","2026-11-12 17:11:35",{"source":8,"skillName":5,"commands":40,"prompt":50,"zipAvailable":51},[41,44,47],{"tool":42,"command":43},"npx","npx skills add jpoindexter\u002FVanta --skill color-and-elevation",{"tool":45,"command":46},"bunx","bunx skills add jpoindexter\u002FVanta --skill color-and-elevation",{"tool":48,"command":49},"pnpm","pnpm dlx skills add jpoindexter\u002FVanta --skill color-and-elevation","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjpoindexter\u002FVanta\u002Fblob\u002Fmain\u002Fdesign-system-skills\u002Fcolor-and-elevation\u002FSKILL.md",true,[],[54,61,68,75,82,88],{"skillNo":55,"name":56,"nameZh":6,"description":57,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":58,"categories":59,"keywords":60,"publishedAt":18},"01M7582PEM7XM8B98VFRDV0C0J","write-changelog","Turn a range of commits into a user-facing changelog","https:\u002F\u002Fgithub.com\u002Fjpoindexter\u002FVanta\u002Fblob\u002Fmain\u002Fvanta-ts\u002Fsrc\u002Fmigrate\u002F__fixtures__\u002Fopenclaw\u002Fskills\u002Fwrite-changelog\u002FSKILL.md",[],[],{"skillNo":62,"name":63,"nameZh":6,"description":64,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":65,"categories":66,"keywords":67,"publishedAt":18},"01M7582KTQJMP5Y7GS83MS1C7Z","debug-flaky-test","Reproduce and isolate a flaky test before fixing it","https:\u002F\u002Fgithub.com\u002Fjpoindexter\u002FVanta\u002Fblob\u002Fmain\u002Fvanta-ts\u002Fsrc\u002Fmigrate\u002F__fixtures__\u002Fopenclaw\u002Fskills\u002Fdebug-flaky-test\u002FSKILL.md",[],[],{"skillNo":69,"name":70,"nameZh":6,"description":71,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":72,"categories":73,"keywords":74,"publishedAt":18},"01M7582HG7XFM4Z5NGG1YFECT8","triage-incident","First 10 minutes of an incident — stabilize, then diagnose","https:\u002F\u002Fgithub.com\u002Fjpoindexter\u002FVanta\u002Fblob\u002Fmain\u002Fvanta-ts\u002Fsrc\u002Fmigrate\u002F__fixtures__\u002Fhermes\u002Fskills\u002Ftriage-incident\u002FSKILL.md",[],[],{"skillNo":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":18},"01M7582DQABK7A96XHMB770KQZ","writing-plans","Write implementation plans: bite-sized tasks, paths, code.","https:\u002F\u002Fgithub.com\u002Fjpoindexter\u002FVanta\u002Fblob\u002Fmain\u002Fvanta-ts\u002Fskills-library\u002Fwriting-plans\u002FSKILL.md",[],[],{"skillNo":83,"name":84,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":18},"01M7582BBK8H0HGSXKK08FCXJ1","vanta-port-adapter","https:\u002F\u002Fgithub.com\u002Fjpoindexter\u002FVanta\u002Fblob\u002Fmain\u002Fvanta-ts\u002Fskills-library\u002Fvanta-port-adapter\u002FSKILL.md",[],[],{"skillNo":89,"name":90,"nameZh":6,"description":91,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":92,"categories":93,"keywords":94,"publishedAt":18},"01M75828P8PX5XSBMJ2BVVDA9Y","test-driven-development","TDD: enforce RED-GREEN-REFACTOR, tests before code.","https:\u002F\u002Fgithub.com\u002Fjpoindexter\u002FVanta\u002Fblob\u002Fmain\u002Fvanta-ts\u002Fskills-library\u002Ftest-driven-development\u002FSKILL.md",[],[]]