Color Everything in CSS (2025)
A comprehensive 2025 guide to CSS color properties and functions, covering newer tools like OKLCH and color-mix(), along with accessibility and theming best practices.
Background
- This is a technical article from CSS-Tricks (a well-known web development blog) published in 2025, covering the modern state of color in CSS (Cascading Style Sheets — the language that styles web pages).
- CSS-Tricks has been a key resource for web developers since 2007. The site was acquired by DigitalOcean in 2022, and its archives remain influential.
- The article likely covers new CSS color features that have matured in recent years: the `color()` function, wider color spaces like Display P3 and sRGB, relative color syntax (e.g. `oklch(from red calc(l + 10) c h)`), and perhaps the new `light-dark()` function for theming.
- It probably revisits older concepts (hex, rgb, hsl) as a baseline, then moves to modern capabilities that let developers use colors beyond the standard sRGB gamut — important for high-end displays (Apple's "wide color" screens, HDR monitors).
- Key terms: OKLCH (a perceptually uniform color space), Display P3 (a wider gamut used by Apple), relative color syntax (modifying one component of a color without knowing the full value).