Skip to content

Commit 4460f57

Browse files
committed
[css-color-5] try to improve bikeshed markup
1 parent 71fe1e3 commit 4460f57

1 file changed

Lines changed: 29 additions & 16 deletions

File tree

css-color-5/Overview.bs

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ Mixing colors: the ''color-mix'' function {#colormix}
8989

9090
<pre class='prod'>
9191
<dfn>color-mix()</dfn> = color-mix( <<color>> <<color>> [ <<number>> | <<percentage>> |
92-
[ <<color-adjuster>> <<colorspace>>? ]?] )
92+
[ [=color-adjuster=] [=colorspace=]? ]?] )
9393
</pre>
9494

9595
<pre class='prod'>
@@ -107,34 +107,34 @@ Mixing colors: the ''color-mix'' function {#colormix}
107107
<dfn>hue-adjuster</dfn> = hue [shorter | longer | increasing | decreasing ]?
108108
</pre>
109109

110-
When no colorspace is specified,
111-
the mixing is done in the ''lch()'' colorspace.
110+
When no [=colorspace=] is specified,
111+
the mixing is done in the ''lch'' colorspace.
112112

113-
When a plain number or percentage is specified (without a color-adjuster),
114-
it applies to all color channels in the given colorspace equally.
113+
When a plain number or percentage is specified (without a [=color-adjuster=]),
114+
it applies to all color channels in the given [=colorspace=] equally.
115115

116116
If the plain number or percentage is omitted,
117117
it defaults to 50% (an equal mix of the two colors).
118118

119-
The xyz colorspace is CIE XYZ and allows computation to be done
120-
in a linear-light-intensity space..
119+
The [=xyz=] colorspace is CIE XYZ, with a D50 whitepoint, and allows computation to be done
120+
in a linear-light-intensity space.
121121

122122
The meaning of the adjusters is defined by colorspace.
123-
For example, if the colorspace is hsl,
123+
For example, if the [=colorspace=] is [=hsl=],
124124
hue means the HSL hue, which is not the same as the LCH hue;
125-
if the colorspace is LCH,
125+
if the colorspace is [=lch=],
126126
lightness means the LCH Lightness, which is the same as Lab lightness,
127127
but different to the HSL Lightness.
128128

129-
Only the adjusters defined for a given colorspace are available.
129+
Only the [=color-adjuster=]s defined for a given [=colorspace=] are available.
130130
For example,
131-
it is not possible to use the HWB whiteness adjuster unless the colorspace is hwb.
131+
it is not possible to use the HWB [=whiteness=] adjuster unless the colorspace is [=hwb=].
132132

133133
If the specified colorspace has a smaller gamut
134134
than the one in which the color to be adjusted is specified,
135135
gamut mapping will occur.
136136

137-
Note: not all adjusters are equally useful.
137+
Note: not all [=color-adjuster=]s are equally useful.
138138
Adjustments in LCH are the most useful, which is why it is the default.
139139
Adjustments on the a and b axes are rarely needed.
140140
Adjustments in the srgb-related spaces (srgb itself, hsl, hwb)
@@ -144,7 +144,7 @@ Adjusting the individual x, y and z channels will produce significant hue shifts
144144
however, adjusting all three channels together is useful
145145
and will lighten or darken the color.
146146

147-
The hue adjuster takes optional keywords, because there are two ways around the hue circle. If no keyword is specified, it is as if ''shorter'' were specified. ''increasing'' is the direction of increasing hue angle; ''decreasing'' is the direction of decreasing hue angle. If the hue difference is exactly 180 degrees,
147+
The [=hue-adjuster=] takes optional keywords, because there are two ways around the hue circle. If no keyword is specified, it is as if ''shorter'' were specified. ''increasing'' is the direction of increasing hue angle; ''decreasing'' is the direction of decreasing hue angle. If the hue difference is exactly 180 degrees,
148148
it is as if ''decreasing'' were specified.
149149

150150
<div class="example">
@@ -323,12 +323,25 @@ are copied across from the <em>first</em> color.
323323

324324
</div>
325325

326-
<!-- number | percent is ambiguous for lightness because lightness is itself a percentage -->
326+
<div class="example">
327+
This example produces the mixture of
328+
the same two colors as the previous examples
329+
(a red and a sky blue),
330+
in ''xyz'' colorspace,
331+
with the mixture being 75.23% of that of the red
332+
(and thus, 24.77% of that of the blue).
327333

328-
<!-- showing out of gamut colors next -->
334+
<pre class="lang-css">color-mix(rgb(82.02% 30.21% 35.02%) rgb(5.64% 55.94% 85.31%) 75.23% xyz);</pre>
329335

336+
The calculation is as follows:
337+
* <span class="swatch" style="--color: rgb(82.02% 30.21% 35.02%)"></span> rgb(82.02% 30.21% 35.02%) is lch(52% 58.1 22.7) which is X=0.3214, Y=0.2014, Z=0.0879.
338+
* <span class="swatch" style="--color: rgb(5.64% 55.94% 85.31%)"></span> rgb(5.64% 55.94% 85.31%) is lch(56% 49.1 257.1) which is X=0.2070, Y=0.2391, Z=0.5249.
339+
* mixed result X=(0.3214 * 0.7523) + (0.2070 * (1 - 0.7523)) = 0.29306.
340+
* mixed result Y=(0.2014 * 0.7523) + (0.2391 * (1 - 0.7523)) = 0.21074.
341+
* mixed result Z=(0.0879 * 0.7523) + (0.5249 * (1 - 0.7523)) = 0.19614.
342+
* mix result is <span class="swatch" style="--color: rgb(72.300% 38.639% 53.557%)"></span> lch(53.0304% 38.9346, 352.8138) which is rgb(72.300% 38.639% 53.557%)
343+
</div>
330344

331-
<!-- <img src="images/mix_red_white_lightness50.png" alt="Result of color-mix(red, white, lightness(50%)" /> -->
332345

333346
<div class="example">
334347
This example produces the mixture of red and yellow,

0 commit comments

Comments
 (0)