Closed psobolewskiPhD closed 1 month ago
Hmm, when I open the CircleCI preview, I still get:
[Log] [PST]: Changed to auto mode using the light theme. (pydata-sphinx-theme.js, line 1)
in the console.
So I must have misunderstood the docs somewhere.
edit: yeah checking on my personal mac, CircleCI artifact I get:
So I'm missing something.
So when I pull up the CircleCI artifact, index.html (and other pages) are correct:
<html lang="en" data-content_root="./" data-theme="light">
But when inspecting, I do see an element that is using auto
:
html.fontawesome-i2svg-active.fontawesome-i2svg-complete
<html lang="en" data-content_root="./" data-theme="light" data-mode="auto" class="fontawesome-i2svg-active fontawesome-i2svg-complete"><head>
and this element covers the whole page, so I suspect it's the one triggering the javascript.
OK, I checked that this element indeed comes from the pydata sphinx theme. Your change looks good but I'm not sure it does much as you observed. We can probably raise this upstream but since I don't use this extension I'm not sure I can help much.
I can poke around over there maybe I can find a fix upstream. Either way, low priority
Actually, looks like it was raised over there https://github.com/pydata/pydata-sphinx-theme/issues/1661 and fixed? https://github.com/pydata/pydata-sphinx-theme/pull/1663 Looking at that PR it does look like it's the trick. So when that is released (it's not in 15.2 as far as I can tell) and we up our pin, then the setting in this PR should work.
In that case I'll leave as approved and we can even merge, just can't forget to check when the release is out. Thanks!
This should work in 15.3, so un-drafting!
Merging main which should rebuild using the new theme (due to changes upstream and in constraints). Hopefully fixes: https://github.com/napari/docs/pull/423#issuecomment-2141165872
Boo, the site builds with 15.3 and 0.4.0 but I still get:
[PST]: Changed to auto mode using the light theme.
And changing my system from light to dark:
[Log] [PST]: Changed to auto mode using the dark theme. (pydata-sphinx-theme.js, line 1)
which makes the bug from https://github.com/napari/docs/pull/423#issuecomment-2141165872 happen.
@melissawm with a little help from ChatGPT4o I figured it out! Here in pydata: https://github.com/pydata/pydata-sphinx-theme/blob/b45af6cc66e25399880183484eab70baf1767b96/src/pydata_sphinx_theme/theme/pydata_sphinx_theme/layout.html#L16-L19
The mode is set using localStorage.getItem("mode")
or if that is null, the default_mode.
The localStorage will persist! So using icognito or removing the cookie did the trick:
So it would appear that anyone that previously visited, got the auto
mode--because it was default. So now they're stuck with it till their cookie expires.
Closing because this was picked over to #423
Depends on https://github.com/napari/docs/pull/423
References and relevant issues
Closes: https://github.com/napari/napari-sphinx-theme/issues/124 See https://github.com/napari/napari-sphinx-theme/issues/124#issuecomment-1930144504 For the docs see: https://pydata-sphinx-theme.readthedocs.io/en/stable/user_guide/light-dark.html#light-and-dark-themes
Description
The default setting is to auto-swap the theme between Light and Dark with system settings, resulting in this in Safari dev console:
[Log] [PST]: Changed to auto mode using the dark theme. (pydata-sphinx-theme.js, line 1)
But we don't actually have a different Dark theme, so it just uses Light, while preventing my extension from darkening it -- but shows Light.With this change, the theme will not auto change and will just use Light. Once we have a Dark theme we can reconsider.