feat: add .dark class selector for theme switching compatibility#69
Merged
Conversation
Many Hugo themes (Blowfish, Tailwind-class-mode themes, Pico, Bulma) signal dark mode with a .dark class on the document root rather than a data-theme attribute. This commit adds .dark as a parallel alternative to the existing [data-theme='dark'] and .theme-dark selectors so the player and footer respond automatically on those themes. No variable values changed. Selectors are purely additive, so existing integrations are unaffected.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
<podcast-player>and<podcast-footer>web components only respond to two dark-mode signals:[data-theme="dark"]on an ancestor element.theme-darkon an ancestor element[data-theme="dark"]on the element itselfMany Hugo themes signal dark mode differently. The most common alternative is the
.darkclass on<html>, used by:data-default-appearancemechanismdarkMode: 'class'(the default)On those themes, the player and footer stay light even when the rest of the page is dark, because the CSS variables are never overridden.
Reproduction
cd exampleSite && hugo server<podcast-player>and<podcast-footer>stay light.Fix
Add
.darkas a parallel alternative to the existing selectors inassets/css/podcast-player.css. Four blocks touched, all additive, zero changed values:::part(player)border override (line 54)::part()border override (line 54)Verification
npm test— passesnpm run lint && npm run format:check— passesgo test ./tests/hugo/...— passesexampleSitewith the toggle above now switches correctlyCompatibility
No breaking changes. Existing
[data-theme="dark"]and.theme-darkselectors are preserved exactly. Sites already working keep working; the only behavior change is that additional themes now also work.Related
No prior issue or PR exists for this.