1. Introduction
This section is not normative.
Web developers, design tools and design system developers often use color functions to assist in scaling the design of their component color relations. With the increasing usage of design systems that support multiple platforms and multiple user preferences, like the increased capability of Dark Mode in UI, this becomes even more useful to not need to manually set color, and to instead have a single source from which schemes are calculated.
Currently Sass, calc() on HSL values, or PostCSS is used to do this. However, preprocessors are unable to work on dynamically adjusted colors; all current solutions are restricted to the sRGB gamut and to the perceptual limitations of HSL (colors are bunched up in the color wheel, and two colors with visually different lightness, like yellow and blue, can have the same HSL lightness).
This module adds two new functions: color-mix(), color-contrast(), and extends existing ones with relative color syntax.
The perceptually uniform ``lch()`` color space is used recommended for mixing, as this has no gamut restrictions and colors are evenly distributed. However, other color spaces can be specified, including ``hsl()`` or ``srgb`` if desired.
2. Color Spaces
Mixing or otherwise combining colors has different results depending on the color space used. In some cases, the result of physically mixing two colored lights is desired (in that case, the CIE XYZ color space is appropriate, because it is linear in light intensity). In other cases, colors which are evenly spaced perceptually are desired (in which case, the CIE Lab color space is designed to be perceptually uniform). Alternatively, maximizing chroma so that color mixtures follow along the hue wheel is wanted (CIE LCH works well for this). Lastly, compatibility with legacy Web content may be the most important consideration. (the sRGB color space, which is neither linear-light nor perceptually uniform, is the choice here).
<color-space> = srgb | hsl | hwb | xyz | lab | lch
The srgb, hsl, hwb, xyz, lab, and lch keywords each refer to their corresponding color space.
When no <color-space> is specified, the mixing is done in the lch color space. The xyz color space is CIE XYZ, with a D50 whitepoint, and allows computation to be done in a linear-light-intensity space.
3. Mixing colors: the color-mix() function
This function takes two <color> specifications and returns the result of mixing them, in a given <color-space>, by a specified amount.
color-mix() = color-mix( in <color-space> , [ <color> && <percentage [0,100]>? ]#{2} <hue-adjuster>?) <hue-adjuster> = shorter | longer | increasing | decreasing | specified
Percentages are required to be in the range 0% to 100%. Negative percentages are specifically disallowed. The percentages are normalized as follows:
-
Let p1 be the first percentage and p2 the second one.
-
If both percentages are omitted, they each default to 50% (an equal mix of the two colors).
-
Otherwise, if p2 is omitted, it becomes 100% - p1
-
Otherwise, if p1 is omitted, it becomes 100% - p2
-
If the percentages sum to zero, the function is invalid.
-
Otherwise, if both are provided and add up to greater than 100%, they are scaled accordingly so that they add up to 100%.
-
Otherwise, if both are provided and add up to less than 100%, the sum is saved as an alpha multiplier. They are then scaled accordingly so that they add up to 100%.
This means that p1 becomes p1 / (p1 + p2) and p2 becomes p2 / (p1 + p2).
color-mix ( in lch, purple50 % , plum50 % ) color-mix ( in lch, purple50 % , plum) color-mix ( in lch, purple, plum50 % ) color-mix ( in lch, purple, plum) color-mix ( in lch, plum, purple) color-mix ( in lch, purple80 % , plum80 % )
All produce a 50-50 mix of purple and plum, in lch: lch(51.51% 52.21 325.8) which is rgb(68.51% 36.01% 68.29%).
However, this form is not the same, as the alpha is less than one:
color-mix ( in lch, purple30 % , plum30 % )
This produces lch(51.51% 52.21 325.8 / 0.6) which is rgb(68.51% 36.01% 68.29% / 0.6).
After normalizing both percentages, the result is produced via the following algorithm:
-
Both colors are converted to the specified <color-space>. If the specified color space has a smaller gamut than the one in which the color to be adjusted is specified, gamut mapping will occur.
-
Colors are then interpolated in the specified color space, as described in CSS Color 4 §13 Interpolation. If the specified color space is a cylindrical-polar-color space, then the <hue-adjuster> controls the interpolation of hue, as described in CSS Color 4 §13.3 Hue interpolation. If no <hue-adjuster> is specified, it is as if shorter had been specified. If the specified colorspace is a rectangular-orthogonal-color space, then specifying a <hue-adjuster> is not an error, but has no effect.
-
If an alpha multiplier was produced during percentage normalization, the alpha component of the interpolated result is multiplied by the alpha multiplier.
The result of mixing is the color at the specified percentage along the progression of the second color to the first color.
Note: As a corrollary, a percentage of 0% just returns the other color converted to the specified color space, and a percentage of 100% returns the same color converted to the specified color space.
color-mix ( in lch, peru40 % , palegoldenrod)
The mixing is done in lch() color space. Here is a top-down view, looking along the neutral L axis:
The calculation is as follows:
-
peru is lch(62.253% 54.011 63.677)
-
palegoldenrod is lch(91.374% 31.406 98.834)
-
the mixed lightness is 62.253 * 40/100 + 91.374 * (100-40)/100 = 79.7256
-
the mixed chroma is 54.011 * 40/100 + 31.406 * (100-40)/100 = 40.448
-
the mixed hue is 63.677 * 40/100 + 98.834 * (100-40)/100 = 84.771
-
the mixed result is lch(79.7256% 40.448 84.771)
Note: interpolating on hue and chroma keeps the intermediate colors as saturated as the endpoint colors.
color-mix ( in lch, teal65 % , olive);
The calculation is as follows:
-
sRGB teal (#008080) is lch(47.9855% 31.6903 196.4524)
-
sRGB olive (#808000) is lch(52.1496% 56.8124 99.5746)
-
mixed lightness is 47.9855 * 0.65 + 52.1496 * 0.35 = 49.4429
-
mixed chroma is 31.6903 * 0.65 + 56.8124 * 0.35 = 40.4830
-
mixed hue is 196.4524 * 0.65 + 99.5746 * 0.35 = 162.5452
-
mixed result is lch(49.4429% 40.4830 162.5452)
-
which is a slightly-blueish green: rgb(7.7377% 52.5730% 37.3213%)
The choice of mixing colorspace can have a large effect on the end result.
color-mix ( in lch, white, black); color-mix ( in xyz, white, black); color-mix ( in srgb, white, black);
The calculation is as follows:
-
sRGB white (#008080) is lch(100% 0 0)
-
sRGB black (#808000) is lch(0% 0 0)
-
The mix in LCH is lch(50% 0 0)
-
The mix in XYZ is lch(76% 0 0)
-
The mix in sRGB is lch(53.4% 0 0)
The mix in LCH gives an L value of 50%, a perfect mid gray, exactly as expected (mixing in Lab would do the same, as the Lightness axis is the same in LCH and Lab).
The mix in XYZ gives a result that is too light; XYZ is linear-light but is not perceptually uniform. The mix in sRGB gives a result that is a bit too light; sRGB is neither perceptually uniform nor linear-light.
color-mix ( in xyz, rgb ( 82.02 % 30.21 % 35.02 % ) 75.23 % , rgb ( 5.64 % 55.94 % 85.31 % ));
The calculation is as follows:
-
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.
-
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.
-
mixed result X=(0.3214 * 0.7523) + (0.2070 * (1 - 0.7523)) = 0.29306.
-
mixed result Y=(0.2014 * 0.7523) + (0.2391 * (1 - 0.7523)) = 0.21074.
-
mixed result Z=(0.0879 * 0.7523) + (0.5249 * (1 - 0.7523)) = 0.19614.
-
mix result is lch(53.0304% 38.9346, 352.8138) which is rgb(72.300% 38.639% 53.557%)
4. Selecting the most contrasting color: the color-contrast() function
This function takes, firstly, a single color (typically a background, but not necessarily), secondly, a list of two or more colors, and thirdly, an optional target luminance contrast [WCAG21]. It selects from that list the first color color to meet or exceed the target contrast. If no target is specified, it selects the first color with the highest contrast to the single color.
The single color is separated from the list with the keyword vs and the target contrast, if present, is separated from the list with the keyword to.
color-contrast() = color-contrast( <color> vs <color>#{2,} [ to [<number> | AA | AA-large | AAA | AAA-large]]? )
The keyword AA is equivalent to 4.5, AA-large is equivalent to 3, AAA is equivalent to 7, and AAA-large is equivalent to 4.5 .
color-contrast ( wheat vs tan, sienna, var ( --myAccent), #d2691e)
The calculation is as follows:
-
wheat (#f5deb3), the background, has relative luminance 0.749
-
tan (#d2b48c) has relative luminance 0.482 and contrast ratio 1.501
-
sienna (#a0522d) has relative luminance 0.137 and contrast ratio 4.273
Suppose myAccent has the value #b22222:
-
#b22222 has relative luminance 0.107 and contrast ratio 5.081
-
#d2691e has relative luminance 0.305 and contrast ratio 2.249
color-contrast ( wheat vs bisque, darkgoldenrod, olive, sienna, darkgreen, maroon to AA)
The calculation is as follows:
-
wheat (#f5deb3), the background, has relative luminance 0.749
-
bisque (#ffe4c4) has relative luminance 0.807 and contrast ratio 1.073
-
darkgoldenrod (#b8860b) has relative luminance 0.273 and contrast ratio 2.477
-
olive (#808000 ) has relative luminance 0.200 and contrast ratio 3.193
-
sienna (#a0522d) has relative luminance 0.137 and contrast ratio 4.274
-
darkgreen (#006400 ) has relative luminance 0.091 and contrast ratio 5.662
-
maroon (#800000 ) has relative luminance 0.046 and contrast ratio 8.333
The first color in the list which meets the desired contrast ratio of 4.5 is darkgreen.
color-contrast ( wheat vs bisque, darkgoldenrod, olive, sienna, darkgreen, maroon to5.8 )
The calculation is as follows:
-
the relative luminances and contrast ratios are the same as the previous example.
The first color in the list which meets the desired contrast ratio of 5.8 is maroon.
The colors in the list (after the keyword vs) are tested sequentially, from left to right; a color is the temporary winner if it has the highest contrast of all those tested so far.
List traversal is terminated once the target contrast has been met or exceeded.
Once the end of the list is reached, if there is no target contrast, the current temporary winner is the overall winner. Thus, if two colors in the list happen to have the same contrast, the earlier in the list wins because the later one has the same contrast, not higher.
If there is a target contrast, and the end of the list is reached without meeting that target, either white or black is returned, whichever has the higher contrast.
color-contrast ( wheat vs bisque, darkgoldenrod, olive to AA)
The calculation is as follows:
-
the relative luminances and contrast ratios are the same as the previous example.
No color in the list meets the desired contrast ratio of 4.5, so black is returned as the contrast (15.982) is higher than that of white (1.314).
foo{ --bg : hsl ( 200 50 % 80 % ); --purple-in-hsl : hsl ( 300 100 % 25 % ); color : color-contrast ( var ( --bg) vshsl ( 200 83 % 23 % ), purple, var ( --purple-in-hsl)); }
The calculation is as follows:
-
--bg is rgb(179 213 230) which has relative luminance 0.628835
-
hsl(200 83% 23%) is rgb(10 75 107) which has relative luminance 0.061575 and contrast ratio 6.08409
-
purple is rgb(128 0 128) which has relative luminance 0.061487 and contrast ratio 6.08889
-
--purple-in-hsl is also rgb(128 0 128) which has relative luminance 0.061487 and contrast ratio 6.08889. This is not greater than the contrast for purple, so purple wins.
The calculated values here are shown to six significant figures, to demonstrate that early rounding to a lower precision would have given the wrong result (0.061575 is very close to 0.061487; 6.08409 is very close to 6.08889).
5. Relative color syntax
In previous levels of this specification, the color functions could only specify colors in an absolute manner, by directly specifying all of the color channels.
The new relative color syntax allows existing colors to be modified using the color functions: if an origin color is specified, then each color channel can either be directly specified, or taken from the origin color (and possibly modified with math functions).
The precise details of each function’s changes to accomodate relative colors are listed below, but they all follow a common structure:
-
An origin color can be specified with a ''from <color>'' value at the start of the function.
-
If an origin color is specified, the remaining arguments can either be specified directly, as normal, be specified as a channel keyword referring to one of the channels of the origin color. Math functions can also use these keywords to do dynamic modifications of the origin color’s channels.
-
Relative color syntax doesn’t change whether an argument is required or optional. If the alpha value is omitted, however, it defaults to taking from the origin color (rather than defaulting to 100%, as it does in the absolute syntax).
If the origin color was originally specified with a different color function, it’s first converted into the chosen color function, so it has meaningful values for the channels.
html{ --bg-color : blue; } .overlay{ background : rgb ( fromvar ( --bg-color) r g b /80 % ); }
In this example, the r, g, and b channels of the origin color are unchanged, indicated by specifying them with the keywords drawing their values from the origin color, but the opacity is set to 80% to make it slightly transparent, regardless of what the origin color’s opacity was.
html{ --color : green; } .foo{ --darker-accent : lch ( fromvar ( --color) calc ( l /2 ) c h); }
In this example, the origin color is darkened by cutting its lightness in half, without changing any other aspect of the color.
Note as well that the origin color is a color keyword (effectively RGB), but it’s automatically interpreted as an LCH color due to being used in the lch() function.
For example, to do a rough approximation of grayscaling a color:
--blue-into-gray : rgb ( fromvar ( --color) calc ( r *.3 + g *.59 + b *.11 ) calc ( r *.3 + g *.59 + b *.11 ) calc ( r *.3 + g *.59 + b *.11 ));
Using this, red would become rgb(30% 30% 30%), green would become rgb(59% 59% 59%), and blue would become rgb(11% 11% 11%). A more moderate color, like darkolivegreen, which has RGB values rgb(85 107 47), would become approximately rgb(37% 37% 37%).
(Note, tho, that an easier and more accurate way to grayscale a color is to use the lch() function, as that color space is more accurate to human perception: lch(from var(--color) l 0 h) preserves the lightness, but zeroes out the chroma, which determines how "colorful" the color is.)
5.1. Relative RGB colors
The grammar of the rgb() function is extended as follows:
rgb() = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <number>{3} [ / <alpha-value> ]? ) | rgb( [ from <color> ]? [ <number> | <percentage> ]{3} [ / <alpha-value> ]? )
Within a relative color syntax rgb() function, the allowed channel keywords are:
-
r, g, and b are all <percentage>s that correspond to the origin color’s red, green, and blue channels after its conversion to sRGB
-
alpha is a <percentage> that corresponds to the origin color’s alpha transparency
rgb(from indianred 255 g b)
This takes the sRGB value of indianred (205 92 92) and replaces the red channel with 255 to give rgb(255 92 92).
5.2. Relative HSL colors
The grammar of the hsl() function is extended as follows:
hsl() = hsl([from <color>]? <hue> <percentage> <percentage> [ / <alpha-value> ]? )
Within a relative color syntax hsl() function, the allowed channel keywords are:
-
h is an <angle> that corresponds to the origin color’s HSL hue after its conversion to sRGB, normalized to a [0deg, 360deg) range
-
s and l are <percentage>s that correspond to the origin color’s HSL saturation and lightness after its conversion to sRGB
-
alpha is a <percentage> that corresponds to the origin color’s alpha transparency
--accent: lightseagreen; --complement: hsl(from var(--accent) calc(h + 180deg) s l);
lightseagreen is hsl(177deg 70% 41%), so --complement is hsl(357deg 70% 41%)
5.3. Relative HWB colors
The grammar of the hwb() function is extended as follows:
hwb() = hwb([from <color>]? <hue> <percentage> <percentage> [ / <alpha-value> ]? )
Within a relative color syntax hwb() function, the allowed channel keywords are:
-
h is an <angle> that corresponds to the origin color’s HWB hue after its conversion to sRGB, normalized to a [0deg, 360deg) range
-
w and b are <percentage>s that correspond to the origin color’s HWB whiteness and blackness after its conversion to sRGB
-
alpha is a <percentage> that corresponds to the origin color’s alpha transparency
5.4. Relative Lab colors
The grammar of the lab() function is extended as follows:
lab() = lab([from <color>]? <percentage> <number> <number> [ / <alpha-value> ]? )
Within a relative color syntax lab() function, the allowed channel keywords are:
-
l is a <percentage> that corresponds to the origin color’s CIE Lightness
-
a and b are <number>s that correspond to the origin color’s CIELab a and b axises
-
alpha is a <percentage> that corresponds to the origin color’s alpha transparency
-
lab(from var(--mycolor) l a b / 100%) sets the alpha of var(--mycolor) to 100% regardless of what it originally was.
-
lab(from var(--mycolor) l a b / calc(alpha * 0.8)) reduces the alpha of var(--mycolor) by 20% of its original value.
-
lab(from var(--mycolor) l a b / calc(alpha - 20%)) reduces the alpha of var(--mycolor) by 20% of 100%.
Note that all the adjustments are lossless in the sense that no gamut clipping occurs, since lab() encompasses all visible color. This is not true for the alpha adjustments in the sRGB based functions (such as 'rgb()', 'hsl()', or 'hwb()'), which would also convert to sRGB in addition to adjusting the alpha transparency.
--mycolor: orchid; // orchid is lab(62.753% 52.460 -34.103) --mygray: lab(from var(--mycolor) l 0 0) // mygray is lab(62.753% 0 0) which is rgb(59.515% 59.515% 59.515%)
5.5. Relative LCH colors
The grammar of the lch() function is extended as follows:
lch() = lch([from <color>]? <percentage> <number> <hue> [ / <alpha-value> ]? )
Within a relative color syntax lch() function, the allowed channel keywords are:
-
l is a <percentage> that corresponds to the origin color’s CIE Lightness
-
c is a <number> that corresponds to the origin color’s LCH chroma
-
h is an <angle> that corresponds to the origin color’s LCH hue, normalized to a [0deg, 360deg) range.
-
alpha is a <percentage> that corresponds to the origin color’s alpha transparency
Because LCH is both perceptually uniform and chroma-preserving, and because the axes correspond to easily understood attributes of a color, LCH is a good choice for color manipulation.
--accent: lightseagreen; --complement: LCH(from var(--accent) l c calc(h + 180deg));
lightseagreen is LCH(65.4937% 39.4484 190.1013), so --complement is LCH(65.4937% 39.4484 370.1013)
--mycolor: orchid; // orchid is lch(62.753% 62.571 326.973) --mygray: lch(from var(--mycolor) l 0 h) // mygray is lch(62.753% 0 326.973) which is rgb(59.515% 59.515% 59.515%)
But now (since the hue was preserved) re-saturating again
--mymuted: lch(from var(--mygray) l 30 h); // mymuted is lch(62.753% 30 326.973) which is rgb(72.710% 53.293% 71.224%)
However, unlike HSL, manipulations are not guaranteed to be in-gamut.
--mycolor: lch(60% 90 320); lch(from var(--mycolor) l c calc(h - 120));
This gives a very high-chroma blue-green, lch(60% 90 200) which is color(srgb -0.6 0.698 0.772) and thus out of gamut (negative red value) for sRGB. Indeed, it is out of gamut for display-p3: color(display-p3 -0.46 0.68 0.758) and even rec2020: color(rec2020 -0.14 0.623 0.729).
The closest color inside the sRGB gamut would be lch(60.71% 37.56 201.1) which is rgb(0% 64.2% 66.3%). The difference in chroma (37.5, instead of 90) is huge.
5.6. Relative color-function colors
The grammar of the color() function is extended as follows:
color() = color( [from <color>]? <colorspace-params> [ / <alpha-value> ]? ) colorspace-params = [<custom-params> | <predefined-rgb-params> | <xyz-params>] custom-params = <dashed-ident> [ <number> | <percentage> ]# predefined-rgb-params = <predefined-rgb> [ <number> | <percentage> ]{3} predefined-rgb = srgb | display-p3 | a98-rgb | prophoto-rgb | rec2020 xyz-params = xyz <number>{3}
Within a relative color syntax color() function using <custom-params>, the number and name of the allowed channel keywords are:
-
defined by the components descriptor on the corresponding @color-profile, if present; otherwise, no relative color manipulation is valid. They are <percentage>s that correspond to the origin color’s channels after its conversion to the color space of the color profile.
Within a relative color syntax color() function using <predefined-rgb-params>, the allowed channel keywords are:
-
r, g, and b are all <percentage>s that correspond to the origin color’s red, green, and blue channels after its conversion to the predefined RGB color space.
Within a relative color syntax color() function using <xyz-params>, the allowed channel keywords are:
-
x, y, z are all <number>s that correspond to the origin color’s X, Y and Z channels after its conversion to relative, D50-adapted CIE XYZ color space.
6. Serialization
This section extends CSS Color 4 §4.7 Serializing <color> Values to add serialization of the results of the color-mix(), color-contrast(), and relative color functions.
In this section, the strings used in the specification and the corresponding characters are as follows.
String | Character |
---|---|
" " | U+0020 SPACE |
"," | U+002C COMMA |
"-" | U+002D HYPHEN-MINUS |
"." | U+002E FULL STOP |
"/" | U+002F SOLIDUS |
The string "." shall be used as a decimal separator, regardless of locale, and there shall be no thousands separator.
As usual, if the alpha of the result is exactly 1, it is omitted from the serialization; an implicit value of 1 (fully opaque) is the default.
6.1. Serializing color-mix()
The serialization of the result of a color-mix() function is a <color>, as defined in CSS Color 4 §4.7 Serializing <color> Values. The form used depends on the color space specified with "in".
The minimum precision for round-tripping is the same as that specified in CSS Color 4 §4.7 Serializing <color> Values.
color space | form |
---|---|
srgb | color(srgb r g b) |
hsl | hsl(h s l) |
hwb | hwb(h w b) |
xyz | color(xyz x y z) |
lab | lab(l a b) |
lch | lch(l c h) |
color-mix(in lch, peru 40%, palegoldenrod)
is serialized as the string "lch(79.7256% 40.448 84.771)" while the result of
color-mix(in srgb, peru 40%, palegoldenrod)
is serialized as the string "color(srgb 0.8816 0.7545 0.4988)".
6.2. Serializing color-contrast()
The serialization of the result of a color-contrast() function is a <color>, as defined in CSS Color 4 §4.7 Serializing <color> Values. The form used is the same as that used to specify the winning color.
The minimum precision for round-tripping is the same as that specified in CSS Color 4 §4.7 Serializing <color> Values.
color-contrast(wheat vs olive, sienna, maroon)
is maroon, so the result is serialized as "rgb(128 0 0)".
While the winner of
color-contrast(wheat vs color(prophoto-rgb 0.4 0.4 0.2), color(display-p3 0.45 0.08 0.05))
is color(display-p3 0.45 0.08 0.05), so the result is serialized as "color(display-p3 0.45 0.08 0.05)".
6.3. Serializing relative color functions
The serialization of the result of a relative color function is a <color>, as defined in CSS Color 4 §4.7 Serializing <color> Values. The form used is the same as that used to specify the relative color, but using the absolute form.
The minimum precision for round-tripping is the same as that specified in CSS Color 4 §4.7.4 Serializing values of the color() function.
lch(from peru calc(l * 0.8) calc(c * 0.7) calc(h + 180))
is the string "lch(49.80224% 37.80819 243.6803)"
7. Security and Privacy Considerations
No new security or privacy considerations have been reported on this specification.
8. Accessibility Considerations
This specification introduces a new feature to help stylesheet authors write stylesheets which conform to WCAG 2.1 section 1.4.3 Contrast (Minimum).
9. Changes
9.1. Since the Working Draft of 1 June 2021
- Clarified minimum precision of serialized forms
- Clarified that CIE LCH is meant
- Added some more examples
- Removed color-adjust(), keeping relative color syntax
- Defined serialization of the results of the color-mix, color-contrast, and relative color syntaxes
9.2. Since the FPWD of 10 June 2020
- Added relative color syntax for the color() function
- Clarified that the color-adjuster is not optional
- Clarified that the percentage in color-mix is mandatory
- Moved hue-adjuster back to color-mix whee it belongs
- Added example with different mxing color spaces
- Added examples of percentage normalization in color-mix()
- Explicitly excluded negative percentages in color-mix()
- Percentages in color-mix() summing to less than 100% produce an alpha transparency less than 100%
- Consistently used the term color space rather than colorspace, defined <color-space> token
- Corrected color-contrast grammar
- Added an optional target contrast ratio to color-contrast()
- Corrected adjuster grammar
- Noted that the corner case of percentages summing to zero needs to be handled
- Clarified order of operations in color-mix()
- Updated examples to match current grammar
- Defined how percentages are normalized
- Clarify meaning of 0% and 100% in color-mix()
- Definition of adjusters moved from color-mix() to color-adjust()
- Allow arguments to color-mix() to be in any order
- Mandatory color space for color-mix()
- Allowed the percentage in color-mix() to come before the color
- Added explicit algorithm for color-mix()
- Removed adjusters from color-mix() and simplified the grammar
- Added the "in" keyword to specify the color space used for mixing
- Required color-contrast() list to have at least two items
- Improved explanation of the relative color syntax
- Link to CSS 4 definition of color serialization
- Added separate section for color spaces
- Updated color-adjust example
- Added explanatory diagrams
- Deal with unresolved percentages
- Normalize arguments to color-mix
- Allow percentages for adjusters
- Link fixes
- Updated color-mix grammar, allowing adjusters, add alpha adjuster
- Corrections to some examples
- Updated Security and Privacy section
- added vs keyword to color-contrast
- added xyz adjuster to grammar
- added hue adjuster keywords
- add XYZ color space for mixing
- defined color-adjuster and color space
- allowed mix percent to default to 50%
- added worked examples and diagrams
- corrected minor spelling, syntax and formatting issues