`contrast-color()` returns whichever of black or white has stronger contrast with a given background. It reduces manual color pairing for components with variable backgrounds.
The demo alternates light and dark swatches so the text color changes. It does not choose arbitrary brand colors or replace accessibility checks for a full page.
When to use
Use it for short labels on user-selected background colors.