W3C home > Mailing lists > Public > www-style@w3.org > March 2015

[css-color] shifting a color to make adequate contrast with another color

From: Andrew VanWagoner <thetalecrafter@gmail.com>
Date: Fri, 6 Mar 2015 09:48:41 -0700
Message-ID: <CAECGhizqr9mWeRN0CeSaMuidaBKjtZ=gJkqe+SOeykeO+Z687g@mail.gmail.com>
To: www-style@w3.org
As it is right now, the contrast() adjuster only makes a color from the
base color that contrasts with the base color. It would be much more useful
to be able to shift one color to make sure it contrasts with a separate
color. And the percentage is not so useful as explicitly providing the
contrast ratio you require.

color(blue contrast(green 3)) would give you a blue-ish color that
contrasts with green at least 3:1.

The use case I have for contrast is to make sure the foreground color
contrasts with the chosen background. I could target 3:1, 4.5:1, or 7:1
depending on the needs of the current user.
Received on Saturday, 7 March 2015 17:06:41 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:52 UTC