DmitriK / darkContrast

Firefox addon that fixes low contrast text when using dark desktop theme
MIT License
63 stars 3 forks source link

Formulas on Wikipedia have low contrast #18

Closed xileF1337 closed 7 years ago

xileF1337 commented 7 years ago

Hi,

thanks for your useful add-on. I am using it with Firefox 53 on a Fedora 25 Linux running KDE 5.9.5 using the Breeze Dark theme. This is the default dark theme shipped with KDE.

Unfortunately, the add on does not seem to fix some contrast problems that arise when reading Wikipedia articles containing mathematical formulas. When using the "Use system colors" option from the Firefox settings, the big ("display mode") formulas are set using the (in my case, bright) system foreground color on a white background. Here is an example:

https://en.wikipedia.org/wiki/Wave_equation#Introduction

And here is a screenshot of the result: screenshot

I also tried disabling the extension (with both the toggle of the extension and via the FF add-on menu), using the default color option, or adding the website to either of the extension lists, but this did not solve the problem. Is this a bug that could be fixed? Thanks for your support.

-Felix

DmitriK commented 7 years ago

Duplicate of #9 Unfortunately, I don't think there is anything I can do to fix this issue, at least not in the short term.

Wikipedia uses SVG images for formulas. These SVG images define their stroke and fill color as 'currentColor', which grabs Firefox's default foreground color, which with 'Use system colors', ends up a light color. The SVG is embedded within the Wiki page as an tag, which means that it's not really in the DOM, thus, a) it does not inherit color, and b) There's no way to modify the internal SVG DOM via JavaScript. There may be a way to manipulate the image data via Canvas for by intercepting and re-writing the requests themselves, but that represents completely new capabilities for the extension.

I would argue this is technically a styling bug on Wikipedia's end. Since they force the page styling to have a white BG, they should explicitly use black as the formula colors. At some point I may try filing a bug with them.

In the meantime, you have a couple of options:

xileF1337 commented 7 years ago

Thanks for your reply. I'm sorry I missed your older bug report. The suggestion of using the "Stylish" add-on turned out to be quite helpful. In case someone else wants to use this work-around, the "Wikipedia 1911 (Dark)" theme seems to work well with the "Use system color" option of FF (some other themes don't!). It also limits the by default unbounded text width on Wikipedia, which always used to be a major annoyance to me. Of course, it would still be cool if you found a way to fix this directly from your add-on ;-)

-Felix