color-mix()
The CSS function that blends two colours in a chosen colour space, often used to make a semi-transparent version of a theme colour.
In more detail
color-mix(in oklab, var(--color-brand) 50%, transparent) gives the brand colour at half opacity while still following theme changes. Tailwind version 4 uses it for opacity modifiers such as bg-brand/50, instead of needing a separate hex value with alpha.
Related terms
- alpha channel — The part of a colour value that sets how transparent it is, from 0 (invisible) to 1 (solid).
- CSS custom property — A value you name yourself in CSS, such as --color-primary: #2563eb, and use elsewhere with var(--color-primary).
- Tailwind CSS — A CSS framework made of small single-purpose utility classes, such as bg-blue-600 or px-4, that you combine in markup.
Taught in
- Tailwind CSS v4 Engine: CSS Variables & Theme Extensions — Design Systems & Component Engineering