DOC: Inheritance diagram for dark mode#15783
Conversation
|
Thank you for your contribution to Astropy! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.
|
This comment was marked as resolved.
This comment was marked as resolved.
2da445a to
f4eb31c
Compare
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as resolved.
This comment was marked as resolved.
f62bb0f to
d329990
Compare
d329990 to
7bf3572
Compare
|
|
||
| /* Flip the colours on graphviz graphs on dark mode */ | ||
| html[data-theme="dark"] div.graphviz > object.inheritance { | ||
| filter: invert(1); |
There was a problem hiding this comment.
If the background of the site isn't pure black you might want to make this 0.9 or something.
There was a problem hiding this comment.
Good point, thanks! I copied over https://github.com/scipy/scipy/blob/c1b803b66a3e9f0416f3feafc6d4cf24d2ec98e2/doc/source/_static/scipy.css#L133 that was mentioned in matplotlib/matplotlib#25983 .
Couldn't figure out how to make the .. plot: directive plot be dark mode friendly but that is out of scope here.
There was a problem hiding this comment.
@Cadair , did lowering the invert stuff make it better or worse? I cannot tell.
| The color of an edge in the graph (i.e., the transformations between two | ||
| frames) is set by the type of transformation; the legend box defines the | ||
| mapping from transform class name to color. | ||
| mapping from transform class name to color (in light mode). |
There was a problem hiding this comment.
I don't like that the colors in the graph and in the legend don't match in dark mode.
There was a problem hiding this comment.
I can also just not touch this one. So that means, normal inheritance diagrams everywhere else will look dark, but this one will remain light mode no matter what. Is that fine by you?
There was a problem hiding this comment.
If dark mode can change colors on the plot then surely it can change the colors in the legend too.
There was a problem hiding this comment.
The colors are hardcoded for light mode. Dark mode uses the "invert" magic. If you know how to grab the color code for inverted value, please suggest changes. Thanks!
There was a problem hiding this comment.
@eerovaher , for the sake of fixing the rest of the diagrams but this one, I am just going to revert the change here and chuck this for future follow-up.
There was a problem hiding this comment.
I'm guessing it should be possible to invert the colors on the legend similarly to how it is done in the graphs, but I don't know CSS well enough to actually make the change immediately.
There was a problem hiding this comment.
OK lemme try one thing but if that doesn't work, I'll exclude this file from dark mode.
There was a problem hiding this comment.
I tried injection class= at ul level and also in a new div container I wrap around ul but neither seems to have any effect. In fact, they disappear in the final rendered HTML when I inspect page source of the RTD preview. Not sure what is going on here. At least I tried.
There was a problem hiding this comment.
You know what... I forgot to refresh the browser. OMG LOL. Anyways, I can try as follow-up PR. Been a long day.
fd8e4b5 to
c4a84dd
Compare
Co-authored-by: Stuart Mumford <stuart@cadair.com>
c4a84dd to
dbcc25d
Compare
attempted but only got the graph to work so it is commented out for now. DOC: Use invert values from scipy CSS by tupui. Although their CSS was for matplotlib but maybe still works here. [ci skip]
dbcc25d to
c197a4a
Compare
…783-on-v6.0.x Backport PR #15783 on branch v6.0.x (DOC: Inheritance diagram for dark mode)
Description
This pull request is to add CSS to handle inheritance diagram for dark mode. I don't know how to do it in a larger scale from upstream like in
sphinx-astropyetc.Fixes astropy/sphinx-automodapi#167
Example inheritance diagram: https://astropy--15783.org.readthedocs.build/en/15783/modeling/reference_api.html#id6
Coordinates frames: https://astropy--15783.org.readthedocs.build/en/15783/coordinates/index.html#module-astropy.coordinates.builtin_frames