Page MenuHomePhabricator

Mathematical SVG images do not change colors based on user preferences
Open, MediumPublic

Description

Originally reported via OTRS: [[ticket:2015090210019503]]

If a user selects monobook, and turns on "black and green," the MathML equations are invisible as they are still rendered with black text.

Event Timeline

Matthewrbowker raised the priority of this task from to Low.
Matthewrbowker updated the task description. (Show Details)
Matthewrbowker added a project: Math.
Matthewrbowker subscribed.

MathJax isn't installed in production, and hasn't been for a while. Also, I don't know what "black and green" is, but I'd guess it's a community gadget. Either way, I think this should be marked as Invalid.

If you are talking about the "SVG fallback" of the MathML mode, then that is expected: different CSS properties are necessary to change the color of SVG paths. This does not happen in when "MathML" is really used since it just inherits the text colors.

This comment was removed by Pkra.

Additional information from the user:

Works fine in Firefox (OSX) and Firefox (CentOS 6.5). Does not work in Chrome (OSX) and Safari (OSX).

Also, the Black on Green is a user gadget.

Matthewrbowker renamed this task from Mathjax is unable to change colors based on user preferences to MathML is unable to change colors based on user preferences.Sep 2 2015, 7:41 PM
Matthewrbowker updated the task description. (Show Details)
Matthewrbowker set Security to None.
Physikerwelt renamed this task from MathML is unable to change colors based on user preferences to Mathematical SVG images do not change colors based on user preferences.Nov 3 2015, 9:36 AM

The snippet mentioned at https://phabricator.wikimedia.org/T195861#4734945 might be useful to users who want a workaround.

Matthewrbowker raised the priority of this task from Low to Medium.Mar 16 2019, 5:31 PM
Matthewrbowker moved this task from Inbox to Created on the User-Matthewrbowker board.

This issue also affects wikis using a black background by default, which is... a lot of video game wikis. Let me describe the T279181 issue in more detail:

Consider the page now archived as https://web.archive.org/web/20210403174906/https://leagueoflegends.fandom.com/wiki/Kill_to_Death_Ratio. The inline formula shown in the screenshot below (F34218188) is written using an inverting filter (resolves to invert(1) in CSS) to make the normal black text "work", but has the side effect of rendering every other color specification useless (orange becomes blue, etc etc). More minor issues with inversion include gamma-antialiased PNG text being thinned.

image.png (445×1 px, 145 KB)

Another trouble with this approach is that... people just can't do it properly (not MediaWiki's fault per se). The block equations on the same page has to use \color{White} because they didn't invert that one.


Some ideas for solving this issue without killing transparency with a forced background include:

  • Allow the site admin to prepend a command to set the default color. Still doesn't fix other skins.
  • Render one dark version and one light version for use on different backgrounds. But there's no way know how to pick between them.
  • Coming up with a better CSS filter that inverts lightness but not color. Sounds great, and you might be able to do it with filter: hue-rotate(180deg) invert(1);.

Some filter fiddling is available at https://en.wikipedia.org/wiki/User:Artoria2e5/css-math-sandbox.