@@ -36,9 +36,10 @@ Introduction {#intro}
36
36
and two colors with visually different lightness,
37
37
like yellow and blue, can have the same HSL lightness).
38
38
39
- This module adds two functions:
39
+ This module adds three functions:
40
40
''color-mix'' ,
41
- ''color-contrast'' .
41
+ ''color-contrast'' ,
42
+ ''color-adjust''
42
43
43
44
The perceptually uniform ``lch()`` colorspace
44
45
is used for mixing by default,
@@ -158,3 +159,35 @@ Selecting the most contrasting color: the ''color-contrast()'' function {#colorc
158
159
159
160
</div>
160
161
162
+ Adjusting colors: the ''color-adjust'' function {#coloradjust}
163
+ =====================================================
164
+
165
+ This function takes one <<color>> specification
166
+ and returns the result of adjusting that color,
167
+ in a given colorspace,
168
+ by a specified transform function.
169
+
170
+ Unless otherwise specified,
171
+ the adjustment is done in the ''lch()'' colorspace.
172
+
173
+ Multiple color functions can be specified.
174
+
175
+ <pre class='prod'>
176
+ <dfn>color-adjust()</dfn> = color-adjust( <<color>> [ <<color-function>> <<colorspace>> ? ]?] )
177
+ </pre>
178
+
179
+ <div class="example">
180
+ This example produces the adjustment of red,
181
+ in ''lch()'' colorspace (the default),
182
+ with the lightness being increased by 30%.
183
+ The chroma and hue of red are left unchanged.
184
+
185
+ <pre class="lang-css"> adjust-color(red, lightness(30%));</pre>
186
+
187
+ The calculation is as follows:
188
+ * sRGB red (#F00) is lch(54.2917 106.8390 40.8526)
189
+ * adjusted lightness is 54.2917 + 30 = 84.2917
190
+ * adjusted result is lch(84.2917 106.8390 40.8526)
191
+ * which is a gray color: rgb(218.5126% 218.5197% 218.4963%)
192
+ </div>
193
+
0 commit comments