css-color-function icon indicating copy to clipboard operation
css-color-function copied to clipboard

Hue angle is not remembering between adjusters

Open Semigradsky opened this issue 8 years ago • 0 comments

One adjuster:

 color(hwb(120, 44%, 50%) w(+ 20%))
//=> rgb(143, 143, 143) | hwb(0, 56%, 44%) | hsl(0, 0%, 56%)

It's okay.

Two adjusters:

color(hwb(120, 44%, 50%) w(+ 20%) s(+ 20%))
//=> rgb(165, 120, 120) | hsl(0, 20%, 56%)

It is not okay. The result should be rgb(120, 165, 120) | hsl(120, 20%, 56%).

See example 11 in spec: https://drafts.csswg.org/css-color-4/#modifying-colors

However, the color-mod() function remembers that the hue of the color was originally 120deg, so when the second operation saturates the color, it will result in a greenish-gray again (hsl(120deg, 20%, 56%), slightly lighter and brighter than the original color, which is what was intended).

Semigradsky avatar Nov 05 '17 17:11 Semigradsky