-
Notifications
You must be signed in to change notification settings - Fork 893
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Documentation is unreadable if the system theme is dark #4385
Comments
On my personal blog I'm handling diagrams with some CSS that inverts the brightness but keeps the hues roughly the same, might be useful here too: filter: url("data:image/svg+xml,<svg xmlns='http%3A//www.w3.org/2000/svg'><filter id='f'><feColorMatrix color-interpolation-filters='sRGB' type='matrix' values='1.47 -1.73 -0.467 0 0.867 -0.733 0.467 -0.467 0 0.867 -0.667 -1.07 1.07 0 0.867 0 0 0 1.0 0'></feColorMatrix></filter></svg>#f"); The |
Oh, that's way more advanced than what I did! Very clever. How's the performance like? |
I haven't noticed any negative performance impact of this, including on mobile browsers, but my blog also isn't the most demanding page in general. AFAICT from chrome's rendering dev tools the SVGs are still rendered once (with the filter applied) into tiles/layers shared with the surrounding content, so unless it's used for animated or otherwise dynamic content I wouldn't expect this to have a significant impact on performance. I didn't find a way to easily check how Firefox behaves here. |
I also found the python script I used to compute the matrix coefficients: invert_filter.py. Lines 13 to 17 contain the foreground and background colors for both themes and lines 19 to 23 are used to constrain the remaining degrees of freedom and I played around with those until it looked good to me. |
E.g. here:
I've fixed this problem before so let me know if you want assistance in doing this in a sphinx-compatibel way without JS.
The text was updated successfully, but these errors were encountered: