You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Besides specifying absolute coordinates, all color functions can also be used with a *relative syntax* to produce colors in the function's target color space, based on an existing color. This syntax consists of the keyword `from`, a <<color>> value, and optionally numerical coordinates specific to the color function. To allow calculations on the original color's coordinates, there are single-letter keywords for each coordinate and `alpha` that corresponds to the color's alpha. If no coordinates are specified, the function merely converts the origin color to the target function's color space.
243
+
Besides specifying absolute coordinates, all color functions can also be used with a *relative syntax* to produce colors in the function's target color space, based on an existing color (henceforth referred to as "origin color"). This syntax consists of the keyword `from`, a <<color>> value, and optionally numerical coordinates specific to the color function. To allow calculations on the original color's coordinates, there are single-letter keywords for each coordinate and `alpha` that corresponds to the color's alpha. If no coordinates are specified, the function merely converts the origin color to the target function's color space.
244
244
245
245
The following sections outline the relative color syntax for each color function.
246
246
@@ -256,7 +256,7 @@ The grammar of the ''rgb()'' function is extended as follows:
The following keywords can also be used in this function (provided the end result conforms to the expected type for the parameter) and correspond to:
259
+
When an origin color is present, the following keywords can also be used in this function (provided the end result conforms to the expected type for the parameter) and correspond to:
260
260
261
261
- 'r' is a <<percentage>> that corresponds to the origin color's red channel after its conversion to sRGB
262
262
- 'g' is a <<percentage>> that corresponds to the origin color's green channel after its conversion to sRGB
@@ -272,7 +272,7 @@ The grammar of the ''hsl()'' function is extended as follows:
272
272
<dfn><hue></dfn> = <<number>> | <<angle>>
273
273
</pre>
274
274
275
-
The following keywords can also be used in this function (provided the end result conforms to the expected type for the parameter) and correspond to:
275
+
When an origin color is present, the following keywords can also be used in this function (provided the end result conforms to the expected type for the parameter) and correspond to:
276
276
277
277
- 'h' is a <<number>> that corresponds to the origin color's HSL hue after its conversion to sRGB, normalized to a [0, 360) range.
278
278
- 's' is a <<percentage>> that corresponds to the origin color's HSL saturation after its conversion to sRGB
@@ -287,7 +287,7 @@ The grammar of the ''hwb()'' function is extended as follows:
The following keywords can also be used in this function (provided the end result conforms to the expected type for the parameter) and correspond to:
290
+
When an origin color is present, the following keywords can also be used in this function (provided the end result conforms to the expected type for the parameter) and correspond to:
291
291
292
292
- 'h' is a <<number>> that corresponds to the origin color's HWB hue after its conversion to sRGB
293
293
- 'w' is a <<percentage>> that corresponds to the origin color's HWB whiteness after its conversion to sRGB
@@ -302,7 +302,7 @@ The grammar of the ''lab()'' function is extended as follows:
The following keywords can also be used in this function (provided the end result conforms to the expected type for the parameter) and correspond to:
305
+
When an origin color is present, the following keywords can also be used in this function (provided the end result conforms to the expected type for the parameter) and correspond to:
306
306
307
307
- 'l' is a <<percentage>> that corresponds to the origin color's CIE Lightness
308
308
- 'a' is a <<number>> that corresponds to the origin color's CIELab a axis
@@ -317,7 +317,7 @@ The grammar of the ''lch()'' function is extended as follows:
The following keywords can also be used in this function (provided the end result conforms to the expected type for the parameter) and correspond to:
320
+
When an origin color is present, the following keywords can also be used in this function (provided the end result conforms to the expected type for the parameter) and correspond to:
321
321
322
322
- 'l' is a <<percentage>> that corresponds to the origin color's CIE Lightness
323
323
- 'c' is a <<number>> that corresponds to the origin color's LCH chroma
@@ -337,7 +337,7 @@ The grammar of the ''gray()'' function is extended as follows:
The following keywords can also be used in this function (provided the end result conforms to the expected type for the parameter) and correspond to:
340
+
When an origin color is present, the following keywords can also be used in this function (provided the end result conforms to the expected type for the parameter) and correspond to:
341
341
342
342
- 'l' is a <<percentage>> that corresponds to the origin color's CIE Lightness
343
343
- 'alpha' is a <<percentage>> that corresponds to the origin color's alpha transparency
0 commit comments