galgebra
galgebra copied to clipboard
Change svg background color for dark mode
Codecov Report
Merging #415 into master will not change coverage. The diff coverage is
n/a
.
@@ Coverage Diff @@
## master #415 +/- ##
=======================================
Coverage 77.56% 77.56%
=======================================
Files 16 16
Lines 4217 4217
=======================================
Hits 3271 3271
Misses 946 946
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 7f57a09...035add5. Read the comment docs.
Somehow this doesn't actually work yet, my guess is that the styles in tag svg
has no effect or no precedence. PR it anyway to mark the issue:
In README:
In https://github.com/pygae/galgebra/blob/master/doc/module-components.rst#latex-printing :
GitHub
Symbolic Geometric Algebra/Calculus package for SymPy :crystal_ball: - pygae/galgebra
Is this a problem just for the readme, or the Sphinx docs too?
Currently only for .md and .rst in Github Dark theme .
https://github.com/StylishThemes/GitHub-Dark
GitHub
:octocat: Dark GitHub style. Contribute to StylishThemes/GitHub-Dark development by creating an account on GitHub.
Somehow this doesn't actually work yet, my guess is that the styles in tag svg has no effect or no precedence.
What I usually do in these cases is create a rectangle for the background, with the same dimensions as the svg document/viewport. For example, for Dop.svg
, that would be:
</defs>
+<rect width="400" height="375" fill="#fcfcfc"/>
<g id="surface1">
May I ask why use rgb(252,252,252)
/ #fcfcfc
instead of plain white, though? That will make these slightly off in a white background.
Also, note that the contents of the SVG files are immediately adjacent to its margins, so a white fill would still not look good in a dark background. You'd need some sort of margin, e.g.:
<?xml version="1.0" encoding="UTF-8"?>
-<svg ... width="400pt" height="375pt" viewBox="0 0 400 375" version="1.1">
+<svg ... width="400pt" height="375pt" viewBox="-10 10 420 395" version="1.1">
<defs>
...
</defs>
+<rect x="-10" y="-10" width="420" height="395" fill="#fcfcfc"/>
<g id="surface1">
...
</g>
</svg>
May I ask why use
rgb(252,252,252)
/#fcfcfc
instead of plain white, though? That will make these slightly off in a white background.
Using rgb(252,252,252)
/ #fcfcfc
is to match the background color of http://galgebra.readthedocs.io/.
What I usually do in these cases is create a rectangle for the background, with the same dimensions as the svg document/viewport. For example, for
Dop.svg
, that would be:</defs> +<rect width="400" height="375" fill="#fcfcfc"/> <g id="surface1">
Thanks for the suggestion. Why I'm hesitating is that this method is too manual, although not much of trouble.
Could alternatively fix this with https://github.com/StylishThemes/GitHub-Dark/issues/1060, which is what makes this work:
Edit: #418 is a failed attempt at this
![](https://render.githubusercontent.com/render/math?math=%5CHuge%20e%5E%7Bi%5Cpi%7D%20%3D%20-1)
gives:
which looks like this:
Sounds like a bug you should report back to Github-Dark.
Sounds like a bug you should report back to Github-Dark.
Indeed, will do that instead.
Related post: https://driesvints.com/blog/investigating-dark-mode-for-svgs-in-github-readmes
Related SO answer: https://stackoverflow.com/a/70200610/200764
Latest official solution: https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#specifying-the-theme-an-image-is-shown-to
Superseded by #503