Fix dark mode variant to follow Nova theme, not OS setting - #212
Open
pawell67 wants to merge 2 commits into
Open
Fix dark mode variant to follow Nova theme, not OS setting#212pawell67 wants to merge 2 commits into
pawell67 wants to merge 2 commits into
Conversation
Tailwind v4 defaults the `dark:` variant to the `prefers-color-scheme` media query, but Nova toggles dark mode via a `.dark` class on the document. After the v4 migration in stepanenko3#211, `dark:` utilities started reacting to the OS theme instead of Nova's theme — so users running Nova in light mode with a dark OS theme saw dark rows/elements in light mode. Re-bind the `dark` variant to the `.dark` class via `@custom-variant`, as documented in the Tailwind v4 dark mode migration guide, and recompile the dist assets. Fixes the regression reported by @kichetof on stepanenko3#211. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Two pre-existing failures inherited from stepanenko3#211, unrelated to the dark mode change but blocking this PR's checks: - Front lint: package.json has no "type": "module", so vite.config.js loads as CommonJS and `require()`-ing the ESM-only @tailwindcss/vite throws ERR_REQUIRE_ESM under the CI Node 20.10. Rename to vite.config.mjs so Vite loads it as ESM. Verified: build fails under Node 20 with .js, passes with .mjs. - PHP Lint (Pint): drop the superfluous `@return null|string` phpdoc on RunsArtisan::getArtisanRunByName() that duplicates the `: ?string` return type (no_superfluous_phpdoc_tags, phpdoc_trim). Verified passing with the repo's pint.json. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Thanks @pawell67 for your quick PR! |
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.
Follow-up to #211.
Problem
Tailwind v4 changed the default
dark:variant from the.darkclass strategy (v3) to the@media (prefers-color-scheme: dark)strategy. Nova toggles dark mode via a.darkclass on the document, so after the v4 migration thedark:utilities started following the OS theme instead of Nova's theme.Result: users running Nova in light mode with a dark OS theme saw dark rows/elements where they should be light — the regression reported by @kichetof (rolled back to 4.5.0 as a workaround).
Fix
Re-bind the
darkvariant to the.darkclass via@custom-variant, per the Tailwind v4 dark mode docs:…and recompile the
distassets.Verification
Compiled
dist/css/tool.cssbefore/after:@media (prefers-color-scheme:dark){…}(1 occurrence) → reacts to OS:where(.dark,.dark *)→ reacts to Nova's.darkclass,prefers-color-schemegone🤖 Generated with Claude Code