Contrast color lab

See how contrast-color() automatically chooses black or white text for a background color.

contrast-color()

Sample text

This text changes automatically to preserve the best available contrast.

Chosen color

CSS code