@@ -559,7 +559,7 @@ Opting Out of a Forced Color Palette: the 'forced-color-adjust' property {#force
559
559
560
560
<pre class=propdef>
561
561
Name : forced-color-adjust
562
- Value : auto | none
562
+ Value : auto | none | preserve-parent-color
563
563
Initial : auto
564
564
Applies to : all elements and text
565
565
Inherited : yes
@@ -587,14 +587,31 @@ Opting Out of a Forced Color Palette: the 'forced-color-adjust' property {#force
587
587
and need to make changes to the UA’s default adjustments
588
588
to provide a more appropriate user experience
589
589
for those elements.
590
+
591
+ : <dfn>preserve-parent-color</dfn>
592
+ :: In [=forced colors mode=] ,
593
+ if the 'color' property inherits from its parent
594
+ (i.e. there is no [=cascaded value=]
595
+ or the [=cascaded value=] is ''currentColor'' , ''inherit'' ,
596
+ or another keyword that inherits from the parent),
597
+ then it computes to the [=used value|used=] color of its parent’s 'color' value.
598
+
599
+ In all other respects, behaves the same as ''none'' .
600
+
601
+ Note: This value is intended solely to get a reasonable behavior
602
+ from embedded SVG elements that expect to receive the outer document's text color
603
+ (and stay consistent with adjustments from [=forced colors mode=] ),
604
+ while otherwise defaulting SVGs
605
+ to preserving their exact colors,
606
+ as [=forced colors mode=] can't generally be usefully applied to illustrations.
590
607
</dl>
591
608
592
609
In order to not break SVG content,
593
610
UAs are expected to add the following rules to their UA style sheet:
594
611
595
- <pre>
612
+ <pre highlight=css >
596
613
@namespace "http://www.w3.org/2000/svg";
597
- svg|svg { forced-color-adjust: none ; }
614
+ svg|svg { forced-color-adjust: preserve-parent-color ; }
598
615
svg|foreignObject { forced-color-adjust: auto; }
599
616
</pre>
600
617
@@ -758,6 +775,13 @@ Changes {#changes}
758
775
<a href="https://github.com/w3c/csswg-drafts/issues/5987">Issue 5987</a> )
759
776
* Renamed 'color-adjust' to 'print-color-adjust' , and re-added 'color-adjust' as an alias/shorthand.
760
777
(<a href="https://github.com/w3c/csswg-drafts/issues/3880">Issue 3880</a> )
778
+ * Added the ''preserve-parent-color'' keyword to 'forced-color-adjust'
779
+ and adjusted the stylesheet to use it,
780
+ to preserve the general "don't mess with SVG colors" behavior
781
+ without breaking use-cases like SVG icons
782
+ that want to use the inherited text color
783
+ <em> after</em> [=forced colors mode=] has taken effect.
784
+ (<a href="https://github.com/w3c/csswg-drafts/issues/6310">Issue 6310</a> )
761
785
762
786
Changes since the <a href="https://www.w3.org/TR/2020/WD-css-color-adjust-1-20200402/">2 April 2020 Working Draft</a> :
763
787
0 commit comments