Skip to content

Commit d6cae6d

Browse files
author
Chris Lilley
committed
[css-c. #olor-4] Correct powerles example to not encourage making saturation powerless. w3c#8609
1 parent 8dc2f87 commit d6cae6d

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

css-color-4/Overview.bs

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,13 +1008,17 @@ any achromatic color will have a [=powerless=] hue component.
10081008
in which components are automatically missing.
10091009

10101010
It can also be specified explicitly,
1011-
by providing the keyword <dfn value for="<color>">none</dfn> for a component in a color function.
1011+
by providing the keyword <dfn value for="<color>">none</dfn>
1012+
for a component in a color function.
10121013
All color functions
10131014
(with the exception of those using the <a>legacy color syntax</a>)
10141015
allow any of their components to be specified as ''none''.
10151016

1017+
This should be done with care,
1018+
and only when the particular effect of doing so is desired.
1019+
10161020
For handling of [=missing component=] in color interpolation,
1017-
see [[#interpolation-missing]]
1021+
see [[#interpolation-missing]].
10181022

10191023
For all other purposes, a [=missing component=] behaves as a zero value,
10201024
in the appropriate unit for that component: ''0'', ''0%'', or ''0deg''.
@@ -1036,32 +1040,32 @@ any achromatic color will have a [=powerless=] hue component.
10361040
one could write ''color-mix(in hsl, white 30%, green 70%)''.
10371041
Since ''white'' is an achromatic color,
10381042
it has a [=missing=] hue when expressed in ''hsl()''
1039-
(effectively ''hsl(none none 100%))'',
1040-
since <em>any</em> hue or saturation will produce the same color)
1043+
(effectively ''hsl(none 0% 100%))'',
1044+
since <em>any</em> hue will produce the same color)
10411045
which means that the color-mix function
1042-
will treat it as having the same hue and saturation as ''green''
1043-
(effectively ''hsl(120deg 100% 100%)''),
1046+
will treat it as having the same hue as ''green''
1047+
(effectively ''hsl(120deg 0% 100%)''),
10441048
and then interpolate based on those components.
10451049

10461050
The result will be a color that truly looks like a blend of green and white,
10471051
rather than perhaps looking reddish
1048-
(if ''white''s hue was defaulted to ''0deg'')
1049-
or grayish
1050-
(if ''white''s saturation was defaulted to ''0%'').
1052+
(if ''white''s hue was defaulted to ''0deg'').
10511053
</div>
10521054

10531055
<div class=example id="ex-grayscale-with-missing">
10541056
Explicitly specifying missing components can be useful
1055-
to achieve an effect where you only <em>want</em> to interpolate certain components of a color.
1057+
to achieve an effect where you only <em>want</em>
1058+
to interpolate certain components of a color.
10561059

10571060
For example, to animate a color to "grayscale", no matter what the color is,
1058-
one can interpolate it with ''lch(none 0 none)''.
1061+
one can interpolate it with ''oklch(none 0 none)''.
10591062
This will take the hue and lightness from the starting color,
10601063
but animate its chroma down to 0,
10611064
rendering it into an equal-lightness gray
10621065
with a steady hue across the whole animation.
10631066

1064-
Doing this manually would require matching the hue and lightness of the starting color explicitly.
1067+
Doing this manually would require
1068+
matching the hue and lightness of the starting color explicitly.
10651069
</div>
10661070

10671071

0 commit comments

Comments
 (0)