Skip to content

Commit 9a43e48

Browse files
committed
Add currentColor as valid syntax
1 parent 94978cc commit 9a43e48

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

css/css-color/parsing/color-valid-relative-color.html

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@
116116
fuzzy_test_valid_color(`rgb(from rgb(none none none / none) r g b / alpha)`, `color(srgb 0 0 0 / 0)`);
117117
fuzzy_test_valid_color(`rgb(from rgb(20% none 60%) r g b)`, `color(srgb 0.2 0 0.6)`);
118118
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+
119123
// hsl(from ...)
120124

121125
// Testing no modifications.
@@ -191,6 +195,9 @@
191195
fuzzy_test_valid_color(`hsl(from hsl(120deg 20% 50% / none) h s l / alpha)`, `color(srgb 0.4 0.6 0.4 / 0)`);
192196
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)`);
193197

198+
// Testing with 'currentColor'
199+
fuzzy_test_valid_color(`hsl(from currentColor h s l)`, `hsl(from currentColor h s l)`);
200+
194201
// hwb(from ...)
195202

196203
// Testing no modifications.
@@ -261,6 +268,9 @@
261268
fuzzy_test_valid_color(`hwb(from hwb(120deg 20% 50% / none) h w b / alpha)`, `color(srgb 0.2 0.5 0.2 / 0)`);
262269
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)`);
263270

271+
// Testing with 'currentColor'
272+
fuzzy_test_valid_color(`hwb(from currentColor h w b)`, `hwb(from currentColor h w b)`);
273+
264274
// lab()
265275

266276
// Testing no modifications.
@@ -324,6 +334,9 @@
324334
fuzzy_test_valid_color(`lab(from lab(25 none 50) l a b)`, `lab(25 0 50)`);
325335
fuzzy_test_valid_color(`lab(from lab(25 20 50 / none) l a b / alpha)`, `lab(25 20 50 / 0)`);
326336

337+
// Testing with 'currentColor'
338+
fuzzy_test_valid_color(`lab(from currentColor l a b)`, `lab(from currentColor l a b)`);
339+
327340
// oklab()
328341

329342
// Testing no modifications.
@@ -387,6 +400,9 @@
387400
fuzzy_test_valid_color(`oklab(from oklab(0.25 none 0.5) l a b)`, `oklab(0.25 0 0.5)`);
388401
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)`);
389402

403+
// Testing with 'currentColor'
404+
fuzzy_test_valid_color(`oklab(from currentColor l a b)`, `oklab(from currentColor l a b)`);
405+
390406
// lch()
391407

392408
// Testing no modifications.
@@ -458,6 +474,9 @@
458474
fuzzy_test_valid_color(`lch(from lch(0.7 none 30) l c h)`, `lch(0.7 0 30)`);
459475
fuzzy_test_valid_color(`lch(from lch(0.7 45 30 / none) l c h / alpha)`, `lch(0.7 45 30 / 0)`);
460476

477+
// Testing with 'currentColor'
478+
fuzzy_test_valid_color(`lch(from currentColor) l c h)`, `lch(from currentColor) l c h)`);
479+
461480
// oklch()
462481

463482
// Testing no modifications.
@@ -530,6 +549,9 @@
530549
fuzzy_test_valid_color(`oklch(from oklch(0.7 none 30) l c h)`, `oklch(0.7 0 30)`);
531550
fuzzy_test_valid_color(`oklch(from oklch(0.7 0.45 30 / none) l c h / alpha)`, `oklch(0.7 0.45 30 / 0)`);
532551

552+
// Testing with 'currentColor'
553+
fuzzy_test_valid_color(`oklch(from currentColor l c h)`, `oklch(from currentColor l c h)`);
554+
533555
for (const colorSpace of [ "srgb", "srgb-linear", "a98-rgb", "rec2020", "prophoto-rgb", "display-p3" ]) {
534556
// Testing no modifications.
535557
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,6 +637,10 @@
615637
fuzzy_test_valid_color(`color(from color(${colorSpace} none none none / none) ${colorSpace} r g b / alpha)`, `color(${colorSpace} 0 0 0 / 0)`);
616638
fuzzy_test_valid_color(`color(from color(${colorSpace} 0.7 none 0.3) ${colorSpace} r g b)`, `color(${colorSpace} 0.7 0 0.3)`);
617639
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+
618644
}
619645

620646
for (const colorSpace of [ "xyz", "xyz-d50", "xyz-d65" ]) {
@@ -675,6 +701,9 @@
675701
fuzzy_test_valid_color(`color(from color(${colorSpace} none none none / none) ${colorSpace} x y z / alpha)`, `color(${resultColorSpace} 0 0 0 / 0)`);
676702
fuzzy_test_valid_color(`color(from color(${colorSpace} 7 none 100) ${colorSpace} x y z)`, `color(${resultColorSpace} 7 0 100)`);
677703
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)`);
678707
}
679708

680709
// Spec Examples: https://www.w3.org/TR/css-color-5/#relative-colors

0 commit comments

Comments
 (0)