Closed return42 closed 2 years ago
Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.
If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).
Welcome to the EBP community! :tada:
If I'm not wrong, this condition is critical ..
it means: when the browser prefers-color-scheme: dark
but the sphinx theme does not set a <body data-theme="light">
the dark colors will be enabled. In sphinx-themes that do not support dark/light the data-theme
attribute is unset and the dark colors come in use.
@Helveg if you have time, could you have a look at this issue / thanks!
Oh, I thought data-theme
was sphinx infused and available across all themes? Does anyone know if themes can be introspected for dark theme support?
If introspection isn't possible we'll have to rely on users setting a flag in the config of this extension. The question then becomes: do we by default enable/disable support for light/dark?
Does anyone know if themes can be introspected for dark theme support?
AFAIK not from within CSS .. I think dark theme support is only available when data-theme
is set?
Why not simply remove the entire @media (prefers-color-scheme: dark)
block?
Why not simply remove the entire @media (prefers-color-scheme: dark) block?
That block is used to select the theme when the browser preference is used. The data-theme
is an override that may be set to override the color scheme preference, but if it isn't set, that means the browser preference should be used.
So 3 cases:
data-theme=dark
: always use dark modedata-theme=light
: always use light modedata-theme
not set, use browser preferenceSo any theme that is always dark, or always light, should set the data-theme
attribute accordingly. I thought this was conventional, extrapolating from how the popular furo
theme does it, but this is probably not commonly done then.
It's hard to decide what to do here, because the browser is telling us to use a dark theme, and the theme is not telling us anything. Opting to always render a light theme would reinstate the inverse problem of light code tabs in dark themes.
but this is probably not commonly done then.
Not really, all themes I know don't set data-theme
.. including RTD, alabaster, book and more see ..
It's hard to decide what to do here, because the browser is telling us to use a dark theme, and the theme is not telling us anything.
BTW: furo sets data-theme="auto"
to use the browser settings. And the values dark
and light
can be toggled by the user.
IMO it is just wrong to assume that "dark" is the default if data-theme
is unset. Since most themes are using "light" colors (see) and do not set data-theme
it is better to assume light is the default. --> and this means, the @media (prefers-color-scheme: dark)
block can be deleted .. or even reworked to come in use when data-them="auto"
.
Or I am wrong?
IMO it is just wrong to assume that "dark" is the default if data-theme is unset.
It doesn't do that, it uses the browser setting. You're right though, furo
uses the auto
value and that solves this issue :) I'll make it so that when data-theme
is absent the light theme is used (and incorporate your PR comments).
It doesn't do that, it uses the browser setting.
Sorry wrong wording, more precise: it is just wrong to assume that "dark" is supported by the theme if data-theme is unset
I'll make it so that when
data-theme
is absent the light theme is used (and incorporate your PR comments).
Thanks a lot!
BTW: as long https://github.com/executablebooks/sphinx-tabs/pull/153 is merged I am also unable to overwrite the tab.css
:-)
I'm not a maintainer of this project :(
I'm not a maintainer of this project :(
No problem, send your PR and then we can ask the maintainers to merge both PRs and build a new release.
@Helveg you don't need to fix it anymore, I send #154 to fix this issue.
@foster could you review & merge #153 and #154 .. and build & deploy a new release? .. thanks a lot!
Describe the bug
context
We use sphinx-tab and Pallets-Sphinx-Themes. Pallets-Sphinx-Themes does not have a dark theme.
Since
has been merged, we got dark tabs in a light theme, when the browser prefers a dark theme:
Rendered in a browser using light theme:
Reproduce the bug
Use sphinx-tabs in a theme that does not have a dark theme and setup your browser to use dark theme.
EDIT: with https://github.com/executablebooks/sphinx-tabs/pull/147/commits/7915f63094d728654cfc9efd1d90fda479c285a5 reverted, the issue is fixed.