|
116 | 116 | fuzzy_test_valid_color(`rgb(from rgb(none none none / none) r g b / alpha)`, `color(srgb 0 0 0 / 0)`);
|
117 | 117 | fuzzy_test_valid_color(`rgb(from rgb(20% none 60%) r g b)`, `color(srgb 0.2 0 0.6)`);
|
118 | 118 | fuzzy_test_valid_color(`rgb(from rgb(20% 40% 60% / none) r g b / alpha)`, `color(srgb 0.2 0.4 0.6 / 0)`);
|
| 119 | + |
| 120 | + // Testing with 'currentColor' |
| 121 | + fuzzy_test_valid_color(`rgb(from currentColor r g b)`, `rgb(from currentColor r g b)`); |
| 122 | + |
119 | 123 | // hsl(from ...)
|
120 | 124 |
|
121 | 125 | // Testing no modifications.
|
|
191 | 195 | fuzzy_test_valid_color(`hsl(from hsl(120deg 20% 50% / none) h s l / alpha)`, `color(srgb 0.4 0.6 0.4 / 0)`);
|
192 | 196 | fuzzy_test_valid_color(`hsl(from hsl(none 20% 50% / .5) h s l / alpha)`, `color(srgb 0.6 0.4 0.4 / 0.5)`);
|
193 | 197 |
|
| 198 | + // Testing with 'currentColor' |
| 199 | + fuzzy_test_valid_color(`hsl(from currentColor h s l)`, `hsl(from currentColor h s l)`); |
| 200 | + |
194 | 201 | // hwb(from ...)
|
195 | 202 |
|
196 | 203 | // Testing no modifications.
|
|
261 | 268 | fuzzy_test_valid_color(`hwb(from hwb(120deg 20% 50% / none) h w b / alpha)`, `color(srgb 0.2 0.5 0.2 / 0)`);
|
262 | 269 | fuzzy_test_valid_color(`hwb(from hwb(none 20% 50% / .5) h w b / alpha)`, `color(srgb 0.5 0.2 0.2 / 0.5)`);
|
263 | 270 |
|
| 271 | + // Testing with 'currentColor' |
| 272 | + fuzzy_test_valid_color(`hwb(from currentColor h w b)`, `hwb(from currentColor h w b)`); |
| 273 | + |
264 | 274 | // lab()
|
265 | 275 |
|
266 | 276 | // Testing no modifications.
|
|
324 | 334 | fuzzy_test_valid_color(`lab(from lab(25 none 50) l a b)`, `lab(25 0 50)`);
|
325 | 335 | fuzzy_test_valid_color(`lab(from lab(25 20 50 / none) l a b / alpha)`, `lab(25 20 50 / 0)`);
|
326 | 336 |
|
| 337 | + // Testing with 'currentColor' |
| 338 | + fuzzy_test_valid_color(`lab(from currentColor l a b)`, `lab(from currentColor l a b)`); |
| 339 | + |
327 | 340 | // oklab()
|
328 | 341 |
|
329 | 342 | // Testing no modifications.
|
|
387 | 400 | fuzzy_test_valid_color(`oklab(from oklab(0.25 none 0.5) l a b)`, `oklab(0.25 0 0.5)`);
|
388 | 401 | fuzzy_test_valid_color(`oklab(from oklab(0.25 0.2 0.5 / none) l a b / alpha)`, `oklab(0.25 0.2 0.5 / 0)`);
|
389 | 402 |
|
| 403 | + // Testing with 'currentColor' |
| 404 | + fuzzy_test_valid_color(`oklab(from currentColor l a b)`, `oklab(from currentColor l a b)`); |
| 405 | + |
390 | 406 | // lch()
|
391 | 407 |
|
392 | 408 | // Testing no modifications.
|
|
458 | 474 | fuzzy_test_valid_color(`lch(from lch(0.7 none 30) l c h)`, `lch(0.7 0 30)`);
|
459 | 475 | fuzzy_test_valid_color(`lch(from lch(0.7 45 30 / none) l c h / alpha)`, `lch(0.7 45 30 / 0)`);
|
460 | 476 |
|
| 477 | + // Testing with 'currentColor' |
| 478 | + fuzzy_test_valid_color(`lch(from currentColor) l c h)`, `lch(from currentColor) l c h)`); |
| 479 | + |
461 | 480 | // oklch()
|
462 | 481 |
|
463 | 482 | // Testing no modifications.
|
|
530 | 549 | fuzzy_test_valid_color(`oklch(from oklch(0.7 none 30) l c h)`, `oklch(0.7 0 30)`);
|
531 | 550 | fuzzy_test_valid_color(`oklch(from oklch(0.7 0.45 30 / none) l c h / alpha)`, `oklch(0.7 0.45 30 / 0)`);
|
532 | 551 |
|
| 552 | + // Testing with 'currentColor' |
| 553 | + fuzzy_test_valid_color(`oklch(from currentColor l c h)`, `oklch(from currentColor l c h)`); |
| 554 | + |
533 | 555 | for (const colorSpace of [ "srgb", "srgb-linear", "a98-rgb", "rec2020", "prophoto-rgb", "display-p3" ]) {
|
534 | 556 | // Testing no modifications.
|
535 | 557 | fuzzy_test_valid_color(`color(from color(${colorSpace} 0.7 0.5 0.3) ${colorSpace} r g b)`, `color(${colorSpace} 0.7 0.5 0.3)`);
|
|
615 | 637 | fuzzy_test_valid_color(`color(from color(${colorSpace} none none none / none) ${colorSpace} r g b / alpha)`, `color(${colorSpace} 0 0 0 / 0)`);
|
616 | 638 | fuzzy_test_valid_color(`color(from color(${colorSpace} 0.7 none 0.3) ${colorSpace} r g b)`, `color(${colorSpace} 0.7 0 0.3)`);
|
617 | 639 | fuzzy_test_valid_color(`color(from color(${colorSpace} 0.7 0.5 0.3 / none) ${colorSpace} r g b / alpha)`, `color(${colorSpace} 0.7 0.5 0.3 / 0)`);
|
| 640 | + |
| 641 | + // Testing with 'currentColor' |
| 642 | + fuzzy_test_valid_color(`color(from currentColor ${colorSpace} r g b)`, `color(from currentColor ${colorSpace} r g b)`); |
| 643 | + |
618 | 644 | }
|
619 | 645 |
|
620 | 646 | for (const colorSpace of [ "xyz", "xyz-d50", "xyz-d65" ]) {
|
|
675 | 701 | fuzzy_test_valid_color(`color(from color(${colorSpace} none none none / none) ${colorSpace} x y z / alpha)`, `color(${resultColorSpace} 0 0 0 / 0)`);
|
676 | 702 | fuzzy_test_valid_color(`color(from color(${colorSpace} 7 none 100) ${colorSpace} x y z)`, `color(${resultColorSpace} 7 0 100)`);
|
677 | 703 | fuzzy_test_valid_color(`color(from color(${colorSpace} 7 -20.5 100 / none) ${colorSpace} x y z / alpha)`, `color(${resultColorSpace} 7 -20.5 100 / 0)`);
|
| 704 | + |
| 705 | + // Testing with 'currentColor' |
| 706 | + fuzzy_test_valid_color(`color(from currentColor ${colorSpace} x y z)`, `color(from currentColor ${colorSpace} x y z)`); |
678 | 707 | }
|
679 | 708 |
|
680 | 709 | // Spec Examples: https://www.w3.org/TR/css-color-5/#relative-colors
|
|
0 commit comments