Feature summary
Give article authors the flexibility to optionally saturate images of the class skin-invert-image. Often, svg diagrams or formula in light mode use well saturated colors to hint the reader to specific aspects of the image. However, if the image is inverted for dark mode with the CSS rule filter: invert(1) hue-rotate(180deg) the colors are pale / dull and are not as useful as in light mode to differentiate parts of the image.
To demonstrate the issue, please refer to the following image, it shows example snippets for light mode, dark mode and a third part with the proposed feature, here adding saturate(60) at the end of the CSS filter chain, from left to right.
- left part: light mode, no filter
- middle part: dark mode, status quo
- rightmost part: filter: invert(1) hue-rotate(180deg) saturate( var( --inv-saturate, 100% ) ) with variable inv-saturate set to a value of 60
Since authors may need to choose a sensible saturate value themselves, the proposed patch defines classes that can be used in conjunction with skin-invert-image to set this value in wikitext, for the example shown: [[File:....|class=skin-invert-image inv-saturate-60]] would be the syntax to configure the filter as to produce the result in the rightmost part.
A legend text, if present, explaining the color code used, needs to be stylable in the same manner, hence <span class="skin-invert inv-saturate-60">..</span> should work likewise for colored text.
The proposed patch ensures this by using inv-saturate-* class selector without coupling it to the presence of a skin-invert-* class. This means it could also be defined independently using a wrapping element somewhere in the DOM, although this is discouraged, see Example4 below.
Use case(s)
appearance of all wikipedia articles with diagrams or formulas, e. g. with a chemistry topic, when viewed with dark mode accessibility feature
Benefits
better readability of inverted diagrams or formulas in dark/night mode
Examplary usage in wikitext
Example1
[[File:Carboxamides.svg|130px|class=skin-invert-image inv-saturate-60]] [[File:Tert-Sulfonicacid Amide Structure V.1.svg|120px|class=skin-invert-image inv-saturate-60]]
Example2
{| class="wikitable skin-invert-image inv-saturate-60"
|-
| [[File:Carboxamides.svg|130px]]
| [[File:Tert-Sulfonicacid Amide Structure V.1.svg|120px]]
|}Example3
<div class="skin-invert-image inv-saturate-60"> [[File:Carboxamides.svg|130px]] [[File:Tert-Sulfonicacid Amide Structure V.1.svg|120px]] </div>
Example4 (discouraged)
This is discouraged for the reason mentioned above. It works as per CSS style definition, but it is harder to read, esp. if the div is filled with more text and the distance between the class assignments increases.
<div class="inv-saturate-60"> lorem ipsum .. [[File:Carboxamides.svg|130px|class=skin-invert-image]] [[File:Tert-Sulfonicacid Amide Structure V.1.svg|120px|class=skin-invert-image]] </div>

