Skip to content

Commit 7cab59d

Browse files
committed
[css-color-5] color-mix() argument normalization
1 parent 8847377 commit 7cab59d

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

css-color-5/Overview.bs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,17 @@ the mixing is done in the ''lch'' colorspace.
118118
The [=xyz=] colorspace is CIE XYZ, with a D50 whitepoint, and allows computation to be done
119119
in a linear-light-intensity space.
120120

121-
When a percentage is specified (without a [=color-adjuster=]),
122-
it is expanded to all adjusters available for the given [=colorspace=] plus alpha.
121+
Arguments are normalized as follows:
123122

124-
If the percentage is omitted and there are no adjusters present,
123+
- When a percentage is specified without any [=color-adjuster=]s,
124+
it is expanded to all adjusters available for the given [=colorspace=] plus alpha.
125+
- If the percentage is omitted and there are no adjusters present on any color arguments,
125126
it defaults to 50% (an equal mix of the two colors).
127+
- If only some adjusters are present, the remaining ones default to 0% (i.e. the corresponding components are taken from the first color).
128+
- If the sum of corresponding adjusters across all colors is not 100%, percentages are scaled proportionally so that the sum is exactly 100%.
126129

127-
Issue: If an adjuster is specified without a percentage, what does its percentage default to?
130+
Issue: Do missing adjusters default to 0% everywhere, or only in the second color?
131+
If the former, we can end up with adjusters that sum to 0% pretty easily.
128132

129133
The meaning of the adjusters is defined by colorspace.
130134
For example, if the [=colorspace=] is [=hsl=],
@@ -133,9 +137,10 @@ if the colorspace is [=lch=],
133137
lightness means the LCH Lightness, which is the same as Lab lightness,
134138
but different to the HSL Lightness.
135139

140+
Issue: If an adjuster is specified without a percentage, what does its percentage default to?
141+
136142
Only the [=color-adjuster=]s defined for a given [=colorspace=] are available.
137-
For example,
138-
it is not possible to use the HWB [=whiteness=] adjuster unless the colorspace is [=hwb=].
143+
For example, it is not possible to use the HWB [=whiteness=] adjuster unless the colorspace is [=hwb=].
139144
The alpha adjuster is available on any color space.
140145

141146
If the specified colorspace has a smaller gamut

0 commit comments

Comments
 (0)