Skip to content

Commit

Permalink
[css-color] Finally remove color-mod() so that people will stop refer…
Browse files Browse the repository at this point in the history
…ring to it; when we add it back it will have different syntax.
  • Loading branch information
tabatkins committed Feb 21, 2018
1 parent 16bbdba commit 034b063
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions css-color-4/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ Representing sRGB Colors: the <<color>> type</h2>

<pre class='prod'>
<dfn>&lt;color></dfn> = <<rgb()>> | <<rgba()>> | <<hsl()>> | <<hsla()>> |
<<hwb()>> | <<gray()>> | <<device-cmyk()>> | <<color-mod()>> |
<<hwb()>> | <<gray()>> | <<device-cmyk()>> |
<<hex-color>> | <<named-color>> | currentcolor |
<<deprecated-system-color>>
</pre>
Expand Down Expand Up @@ -239,7 +239,6 @@ Resolving Color values</h2>
* ''lab()'' and ''lch()''
* ''gray()''
* ''color()''
* ''color-mod()''
</div>

Issue: Define if changing the working color space should have any impact on the above.
Expand Down Expand Up @@ -2278,7 +2277,7 @@ Converting Between Uncalibrated CMYK and RGB-Based Colors</h3>
<li>fallback color must be set to the input color
</ul>


<!--
<h2 id='modifying-colors'>
Modifying Colors: the ''color-mod()'' function</h2>
Expand Down Expand Up @@ -2777,7 +2776,7 @@ Issue: The code below is only for sRGB, and duplicates the
Note: The contrast ratio of two colors is contained within the range [1,21],
where two identical colors are 1 and the ratio of white and black is 21.

-->

<h2 id="transparency">
Transparency: the 'opacity' property</h2>
Expand Down

4 comments on commit 034b063

@gregwhitworth
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tabatkins @svgeesus Why was this removed? This is a common problem space and with custom properties this even more desired.

@tabatkins
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good feature, bad syntax, and needed to be based on lab space, not rgb. Until someone properly worked on it, it was misleading lots of people.

@wbond
Copy link

@wbond wbond commented on 034b063 Jun 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tabatkins Is HSL an appropriate color space for this feature? If not, is there anywhere someone like myself could read about the pros of LAB vs HSL? Or, is it just that it should default to LAB instead of RGB?

@tabatkins
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is HSL an appropriate color space for this feature?

Very much not, unfortunately - HSL is just a slightly tweaked version of RGB. (Take the RGB cube and set it so that it's resting on its black corner, with the white corner on top - the six pure colors then zig-zag around the center in red-yellow-green-cyan-blue-magenta order. This is 90% of the RGB->HSL transformation, and I'm being completely serious, it's just a little tweak in how you set up the axises in the space and then some minor scaling.)

@svgeesus can probably point you to learning resources, but the core detail is that Lab is based on human perception, not computer-display convenience, and as a result it was able to be designed so that its axises are actually independent. If you change the hue but leave the lightness alone, the colors you get are actually the same lightness, whereas when you change the hue in HSL your brightness values swing all over the map. (hsl(60deg, 100%, 50%) (bright yellow) and hsl(240deg, 100%, 50%) (bright blue) are dramatically different in actual brightness; text that can be easily read on a blue background can easily be totally unreadable on yellow, and vice versa.) Because of this, the notion of a "hue adjuster" or "lightness adjuster" in HSL (or any of the RGB-derived colorspaces) is fundamentally flawed and only of limited usefulness.

This nice SE answer goes into slightly more detail without getting too technical.

Please sign in to comment.