Skip to content

Commit a440938

Browse files
[DOC] Tooltips are always shown in light mode, even in dark mode. (#2348)
* pin sphinx-hoverxref version to 1.4.x, where x>2 For reference: https://stackoverflow.com/questions/39590187/in-requirements-txt-what-does-tilde-equals-mean * Create hoverxref-darkmode.css * oopsy hoopsy typo * hmmmm when did this break? 👀 * Imma stupid for this, sorry Kevin 🙇 * 🚀 i did it * Code review (Kevin) Co-authored-by: Kevin Anderson <[email protected]> --------- Co-authored-by: Kevin Anderson <[email protected]>
1 parent e183417 commit a440938

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/* Overrides for sphinx-hoverxref since it does not support a native dark theme, see */
2+
/* https://github.com/readthedocs/sphinx-hoverxref/issues/231 */
3+
/* Inspired by https://github.com/pybamm-team/PyBaMM/pull/3083 */
4+
5+
/* These will ensure that the tooltip inherits the pydata-sphinx-theme colours */
6+
7+
.tooltipster-sidetip.tooltipster-shadow.tooltipster-shadow-custom .tooltipster-content {
8+
background-color: var(--pst-color-background) !important;
9+
color: var(--pst-color-text-base) !important;
10+
}

Diff for: docs/sphinx/source/conf.py

+2
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,8 @@ def setup(app):
282282
app.add_css_file("reference_format.css")
283283
# Add a warning banner at the top of the page if viewing the "latest" docs
284284
app.add_js_file("version-alert.js")
285+
# Match the color theme of tooltips to PyData Sphinx Theme light/dark mode
286+
app.add_css_file("tooltipster_color_theming.css")
285287

286288
# -- Options for LaTeX output ---------------------------------------------
287289

Diff for: pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ doc = [
6666
'sphinx-toggleprompt == 0.5.2',
6767
'sphinx-favicon',
6868
'solarfactors',
69-
'sphinx-hoverxref',
69+
'sphinx-hoverxref ~= 1.4.2', # when updating, check that _static/tooltipster_color_theming.css still works
7070
]
7171
test = [
7272
'pytest',

0 commit comments

Comments
 (0)