A pragmatic guide to modern CSS colours - part one ๐Ÿ”— **Source:** [A pragmatic guide to modern CSS colours - part one](https://piccalil.li/blog/a-pragmatic-guide-to-modern-css-colours-part-one/) > [!note]+ Document Notes > tags: [CSS, Color, Web Design] > author: Kevin Powell > source: Piccalilli > reference: [https://piccalil.li/blog/a-pragmatic-guide-to-modern-css-colours-part-one/] > date created: 2025-10-08 00:00 > > # ๐Ÿท๏ธ Title: A pragmatic guide to modern CSS colours - part one > <!-- deep-read:sections start --> ## ๐Ÿงญ Table of Contents - [๐Ÿ“ Summary](#-summary) - [๐Ÿ“– Main Content](#-main-content) - [๐Ÿ—’๏ธ Notes](#๏ธ-notes) - [๐Ÿ“š References](#-references) - [๐Ÿ—ฃ๏ธ Paraphrase](#๏ธ-paraphrase) - [๐Ÿ“ฐ Newsletter](#-newsletter) - [โœ… Action Items](#-action-items) - [๐Ÿงช Hypotheses](#-hypotheses) - [๐Ÿ“Š Methodology](#-methodology) - [โ“ Questions](#-questions) - [๐Ÿ”ฎ Future Research](#-future-research) - [๐Ÿ’ก Implications](#-implications) - [๐Ÿง  Learning Styles Assessment](#-learning-styles-assessment) - [๐Ÿ“Š Accessibility Assessment](#-accessibility-assessment) - [๐ŸŒ DEIB Assessment](#-deib-assessment) - [โœ… Logical Validity](#-logical-validity) - [๐Ÿ›ก๏ธ DARVO Analysis](#-darvo-analysis) - [๐ŸŽฏ Conclusion](#-conclusion) ### ๐Ÿ”— References - Include links cited in or relevant to the article. ## ๐Ÿ“ Summary - What happened: A pragmatic intro to modern CSS color spaces (OKLCH/LCH/Lab, P3), why theyโ€™re better than sRGB, and how to adopt them safely. - Why it matters: More consistent, perceptually uniform colors; wider gamuts on modern displays; easier scaling of design systems. - Key stakeholders: Front-end developers, designers, accessibility specialists, design system maintainers. - Risks and tradeoffs: Browser support gaps; gamut clipping; tooling/hand-off changes; need for fallbacks. - Bottom line: Prefer OKLCH (or LCH) with progressive enhancement and keep sRGB fallbacks; use color-mix() and relative color syntax where available. ## ๐Ÿ“– Main Content - Core arguments: - sRGB is limited; modern displays support wider gamuts like Display-P3. - Perceptually uniform spaces (OKLCH/LCH) make predictable lightness/chroma adjustments. - Modern CSS adds OKLCH/LCH/ Lab notations, relative color syntax, and color-mix() for robust theming. - Use progressive enhancement: ship sRGB fallback, enhance with OKLCH/P3 when supported. - Context and definitions: - Perceptual uniformity: equal numeric steps โ‰ˆ equal visual change. - Gamut: range of colors a device can show (e.g., sRGB vs Display-P3). - OKLCH: coordinates are lightness (L), chroma (C), hue (H); great for design tokens. - Uncertainties: - color-contrast() remains in flux; rely on established contrast methods. - P3 authoring via color() support varies; test and provide fallbacks. ### ๐Ÿ—’๏ธ Notes - sRGB isnโ€™t enough for modern devices; P3 yields richer colors on supported screens. - OKLCH/LCH improve predictability when adjusting lightness and saturation. - Practical approach: define tokens in OKLCH, provide hex/rgb fallbacks. - Use color-mix() for generating scales and states from a base token. - Check gamut and contrast; avoid over-saturated out-of-gamut picks. ## ๐Ÿ“š References - CSS Color Module Level 4 (W3C) โ€” definitions and notations: https://www.w3.org/TR/css-color-4/ - CSS Color Module Level 5 (W3C) โ€” color-mix and more: https://www.w3.org/TR/css-color-5/ - MDN: OKLCH color() function and notations: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/oklch - MDN: color-mix() function: https://developer.mozilla.org/en-US/docs/Web/CSS/color-mix - โ€œOKLCH in CSS: why we moved from HSLโ€ by Evil Martians: https://evilmartians.com/chronicles/oklch-in-css-why-quit-rgb-hsl - APCA (advanced contrast) overview: https://apcacontrast.com/ ## ๐Ÿ—ฃ๏ธ Paraphrase - Paragraph A: Modern CSS color spaces provide broader color ranges and more predictable visual changes than legacy sRGB, improving consistency across devices. - Paragraph B: Adopt them incrementally with sRGB fallbacks, using OKLCH for tokens and tools like color-mix() to generate accessible, scalable palettes. ## ๐Ÿ“ฐ Newsletter Discover why OKLCH/LCH are reshaping CSS color. Kevin Powellโ€™s new primer shows how perceptually uniform spaces make token-based themes and state colors predictableโ€”plus safer progressive enhancement with sRGB fallbacks. Try color-mix() to derive hover/active states, and test P3 benefits on supported screens. Handy reads: MDN on color-mix(), W3C CSS Color 4/5, and the Evil Martians OKLCH guide. ## โœ… Action Items #### DevRel - Publish a โ€œFrom HSL to OKLCHโ€ code lab and sample repo; measure adoption via GitHub stars and workshop NPS. - Office hours: migrating design tokens to OKLCH with sRGB fallbacks. - Add examples to docs: color-mix() with progressive enhancement. #### OSPO - Policy: approve OKLCH and color-mix() in style guides with fallback requirements. - Compliance: update scanning to flag non-compliant contrast ratios. - Security: standardize signed design tokens distributions. #### Community - Maintainer clinics: palette governance and semver for tokens. - Contributor pairing: convert components to OKLCH with tests. - Sponsors: fund accessibility audits tied to color upgrades. #### WordPress - Core: evaluate OKLCH tokens; keep hex/rgb fallbacks. - Design: introduce design tokens with perceptual steps. - Documentation: examples-first patterns for color-mix() usage. - Accessibility: automate contrast checks against tokens. #### The WPOCC - Programs: microgrants for accessibility-first color refactors. - Projects: documentation sprints for token standards. - Funding experiments: milestone-based payouts for theme conversions. ### FAIR - Independence: include provenance and signatures for token files. - Policies: transparency on color decisions; sunset legacy palettes. - Governance artifacts: publish token charters and scorecards. ## ๐Ÿงช Hypotheses - Using OKLCH tokens reduces color-related accessibility regressions by โ‰ฅ30%. - color-mix()-derived states improve design consistency scores by โ‰ฅ20%. - Progressive enhancement with P3 + sRGB fallback reduces visual discrepancies on mixed fleets by โ‰ฅ25%. - Teams ship palettes faster (โ‰ฅ15%) when using perceptual steps vs HSL. ### ๐Ÿ“Š Methodology - A/B component libraries (HSL vs OKLCH); track contrast issues and review time. - Visual diff tests across sRGB-only and P3 displays. - Developer surveys on predictability/effort; UX audits for consistency ratings. ### โ“ Questions - Where do current browsers still clip OKLCH or P3 notably? - What token naming best maps to perceptual steps? - How to encode contrast rules directly into token pipelines? ### ๐Ÿ”ฎ Future Research - Automated gamut-aware token linters. - APCA-integrated color selection workflows. - Authoring P3 assets with fallback previews in design tools. ### ๐Ÿ’ก Implications - Practice: simpler theming, safer scaling across brands. - Policy: codify fallback and contrast requirements. - Education: train on perceptual spaces and progressive enhancement. ### ๐Ÿง  Learning Styles Assessment - Reading level: ~10โ€“11th grade (FKGL โ‰ˆ 10.5) #### ๐Ÿ‘€ Visual learners - Present: conceptual contrasts (sRGB vs P3), code examples. - Improve: before/after swatches and chroma/lightness plots. #### ๐Ÿ”Š Aural learners - Improve: 3-minute audio summary and TTS. #### ๐Ÿ—ฃ๏ธ Verbal learners - Present: clear definitions and analogies. - Improve: glossary of color terms. #### ๐Ÿงฉ Kinesthetic learners - Present: try-it code snippets. - Improve: sandbox with toggles for fallbacks/gamut. #### ๐Ÿง  Logical learners - Present: stepwise token migration. - Improve: decision tree for color choices. #### ๐Ÿง‘โ€๐Ÿคโ€๐Ÿง‘ Social learners - Improve: forum thread for palette reviews. #### ๐Ÿง˜โ€โ™€๏ธ Solitary learners - Present: self-paced reading. - Improve: reflection prompts and quick checks. #### ๐ŸŒฟ Naturalistic learners - Improve: tie color choices to energy/contrast efficiency. ### ๐Ÿ“Š Accessibility Assessment #### Screen reader semantics - Present: headings; clear structure. - Improve: descriptive alt text guidance for palettes. #### Keyboard navigation - Improve: include focus state token examples. #### Contrast and readability - Present: emphasis on contrast. - Improve: APCA guidance and thresholds. #### Text resizing and reflow - Improve: note on prefers-reduced-motion and reflow tests. #### Media and captions - Improve: provide transcript/audio alternatives. #### Forms and interactions - Improve: inline validation color patterns with non-color cues. #### Standards reference - Map to WCAG 2.2 AA: 1.4.3, 1.4.11, 1.4.12, 2.4.x. ### ๐ŸŒ DEIB Assessment - Cultural breadth: improve multilingual references and examples. - Inclusive language: mostly neutral; add plain-language callouts. - Neurodiversity: consistent structure; add icon+text labels. - Representation: improve inclusive imagery guidance. - Psychological safety: add community guidelines for feedback. ### โœ… Logical Validity #### Strong reasoning - Inductive: perceptual uniformity โ†’ predictable adjustments; supported by OKLCH properties. - Causal: wider gamut support โ†’ richer colors on capable devices when enhanced progressively. #### Fallacies - Avoid overstating support; always pair with fallbacks. #### Tone of voice - Pragmatic, instructional, encouraging. ### ๐Ÿ›ก๏ธ DARVO Analysis - No denial/attack/reversal patterns; instructional content without adversarial framing. ## ๐ŸŽฏ Conclusion - Bottom line: Use OKLCH (or LCH) for tokens with sRGB fallbacks, apply color-mix() for states, and progressively enhance for P3. Test contrast and gamut. - Next steps: Audit tokens, define OKLCH scale, add fallbacks, implement color-mix(), and integrate automated contrast checks. ## ๐Ÿงฑ Refactor Appendix (append after ๐ŸŽฏ Conclusion) ``` ### ๐Ÿ“š Literature Split Pad - Purpose: Stage Konik CEE units that become per-source Literature notes. - Split level: H3. - Include verbatim quotes under 25 words and a [view highlight] link. ### [H1] 5โ€“10-word present-tense claim > [!quote] [A pragmatic guide to modern CSS colours - part one](https://piccalil.li/blog/a-pragmatic-guide-to-modern-css-colours-part-one/) by [[Kevin Powell]] via [[Piccalilli]]. Published 2025-10-07. Accessed 2025-10-08. > โ€œPerceptually uniform spaces make color adjustments predictable.โ€ Two lines: context and use. Cite data if relevant. [view highlight](https://piccalil.li/blog/a-pragmatic-guide-to-modern-css-colours-part-one/#H1) #xref #articleseed ID:rw_[MISSING] ### [H2] 5โ€“10-word present-tense claim > [!quote] [A pragmatic guide to modern CSS colours - part one](https://piccalil.li/blog/a-pragmatic-guide-to-modern-css-colours-part-one/) > โ€œShip sRGB fallbacks; progressively enhance with OKLCH/P3.โ€ Two lines: context and use. [view highlight](https://piccalil.li/blog/a-pragmatic-guide-to-modern-css-colours-part-one/#H2) #xref ID:rw_[MISSING] --- ### ๐Ÿ”– Atomic Split Pad (Zettel Candidates) - Purpose: Promote reusable claims into Atomic notes. - Split level: H4. - Each item: one idea, present tense, specific, testable. #### [Z1] OKLCH tokens improve predictability of scales - Applies to design systems migrating from HSL. - Pointer: โ€œPart oneโ€ guide, section on perceptual uniformity. - Links: [[Design Tokens]] [[CSS Color]] #### [Z2] Progressive enhancement reduces color discrepancies - Mixed device fleets with partial P3 support. - Links: [[Progressive Enhancement]] [[Display-P3]] --- ### โœ๏ธ Fleeting Queue (Extract by Selection) - Purpose: Capture quick actions or sparks for Fleeting notes. - Extraction: Select one line โ†’ Refactor. - [F1] Draft OKLCH token scale for brand โ€” context/https://piccalil.li/blog/a-pragmatic-guide-to-modern-css-colours-part-one/ #fleeting #inbox - [F2] Add color-mix() utilities to CSS framework โ€” context/https://piccalil.li/blog/a-pragmatic-guide-to-modern-css-colours-part-one/ #fleeting #inbox - [F3] Set up P3 preview QA on Mac devices โ€” context/https://piccalil.li/blog/a-pragmatic-guide-to-modern-css-colours-part-one/ #fleeting #inbox --- <!-- deep-read:sections end -->