Skip to content

Fix dark mode variant to follow Nova theme, not OS setting - #212

Open
pawell67 wants to merge 2 commits into
stepanenko3:mainfrom
pawell67:fix-dark-mode-variant-tailwind4
Open

Fix dark mode variant to follow Nova theme, not OS setting#212
pawell67 wants to merge 2 commits into
stepanenko3:mainfrom
pawell67:fix-dark-mode-variant-tailwind4

Conversation

@pawell67

Copy link
Copy Markdown
Contributor

Follow-up to #211.

Problem

Tailwind v4 changed the default dark: variant from the .dark class strategy (v3) to the @media (prefers-color-scheme: dark) strategy. Nova toggles dark mode via a .dark class on the document, so after the v4 migration the dark: 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 dark variant to the .dark class via @custom-variant, per the Tailwind v4 dark mode docs:

@custom-variant dark (&:where(.dark, .dark *));

…and recompile the dist assets.

Verification

Compiled dist/css/tool.css before/after:

  • before: @media (prefers-color-scheme:dark){…} (1 occurrence) → reacts to OS
  • after: :where(.dark,.dark *) → reacts to Nova's .dark class, prefers-color-scheme gone

🤖 Generated with Claude Code

pawell67 and others added 2 commits June 26, 2026 12:26
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>
@kichetof

kichetof commented Jul 6, 2026

Copy link
Copy Markdown

Thanks @pawell67 for your quick PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants