forked from pydata/pydata-sphinx-theme
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Inheritance Diagram Dark Mode Support (pydata#1834)
Apply CSS filtering to have the inheritance diagram conform to dark mode, and add a example demonstrating inheritance diagram in kitchensink.. We also install graphviz on CI to test this. The css will only apply to inheritance diagram and not to all graphviz output. Addresses pydata#820
- Loading branch information
Showing
8 changed files
with
83 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
======== | ||
Graphviz | ||
======== | ||
|
||
Inheritance Diagram | ||
------------------- | ||
|
||
If you use :mod:`sphinx.ext.inheritance_diagram` to generate inheritance diagrams with | ||
:mod:`sphinx.ext.graphviz`, and you output the inheritance diagrams in SVG format, | ||
they will automatically adapt to this theme's light or dark mode. | ||
|
||
To have the inheritance-diagram render to SVG, inside ``conf.py``, you need | ||
the following option. | ||
|
||
.. code-block:: python | ||
# conf.py | ||
... | ||
graphviz_output_format = 'svg' | ||
... | ||
Below is an example of the inheritance diagram for ``matplotlib.figure.Figure``. | ||
Try toggling light/dark mode to see it adapt! | ||
|
||
.. inheritance-diagram:: matplotlib.figure.Figure | ||
|
||
See the sphinx inheritance-diagram `documentation`_ for more information. | ||
|
||
.. _documentation: https://www.sphinx-doc.org/en/master/usage/extensions/inheritance.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
src/pydata_sphinx_theme/assets/styles/extensions/_graphviz.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/* Styles for graphviz generated output from Sphinx */ | ||
|
||
/* Style the inheritance diagram such that it has a dark mode */ | ||
html[data-theme="dark"] div.graphviz > object.inheritance { | ||
filter: brightness(0.8) invert(0.82) contrast(1.2); | ||
color-scheme: normal; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters