Re: [css-color] copying a value from another color

On Thu, Mar 5, 2015 at 5:18 PM, Andrew VanWagoner
<thetalecrafter@gmail.com> wrote:
> It would be very useful if color adjusters could take a color parameter,
> instead of just a number or percentage, and simply take the color's value.
>
> For example, trying to express a color with proper contrast from a
> background color, and using the hue of known color:
>
> color(var(--background) contrast(0%) hue(var(--color-theme)))

I've thought about something like this, but didn't come up with much
in the way of a use-case.  Would it help if there was just a way to
run the contrast() adjuster on two colors: the foreground color you
want to alter and the background color you want it to contrast
against?  (I think this is the subject of your other thread; I haven't
read past its title yet.)

> side note: contrast(100%) is always either black or white, and I would guess
> would be used a lot less than contrast(0%) which finds the minimum
> contrasting color. It's odd in my mind that the default if omitted is 100%.

I imagine a major use-case for the contrast adjuster is to
automatically set the text color appropriately, given a background
color that it'll be displayed over.  In that case, black/white is the
most common.  It's also the safest choice, as it provides maximum
contrast (minimum contrast is set to the WCAG AA level of contrast;
you should usually try for AAA level for maximum readability).

~TJ

Received on Monday, 9 March 2015 22:19:32 UTC