Skip to content

Force dark theme on web regardless of device color scheme - #20

Merged
jnahian merged 1 commit into
mainfrom
claude/brave-planck-fgwteq
Jun 11, 2026
Merged

jnahian merged 1 commit into
mainfrom
claude/brave-planck-fgwteq

Conversation

@jnahian

@jnahian jnahian commented Jun 11, 2026

Copy link
Copy Markdown
Owner

Problem

On devices set to light mode, parts of the landing page rendered with light backgrounds — the "Built for every use case" card headers and the "See it in action" interactive demos — while the rest of the site stayed dark.

Cause

The site always sets <html class="dark">, but Tailwind v4's dark: variant defaults to the prefers-color-scheme media query, not the .dark class. So on light-mode devices, every dark:* utility fell back to its light variant.

Fix

In web/src/styles/globals.css:

  • Override the dark variant to key off the .dark class: @custom-variant dark (&:where(.dark, .dark *)); — since the class is always present, the site is always dark with no theme toggle needed.
  • Add color-scheme: dark so native UI (form controls, scrollbars) matches.

Verified: the production build compiles with zero prefers-color-scheme queries and all 74 dark rules scoped to the .dark class.

https://claude.ai/code/session_01QFB1GtUSutKGZVRnEGkx8X


Generated by Claude Code

Summary by CodeRabbit

  • Improvements
    • Enhanced dark mode styling configuration for better browser compatibility and explicit dark theme signaling.

Tailwind v4's dark: variant defaults to prefers-color-scheme, so on
light-mode devices the dark:* utilities (use-case card gradients,
interactive demo components, etc.) fell back to their light variants
even though <html> always has the dark class. Override the dark
variant to key off the .dark class instead, and set color-scheme: dark
so native UI (form controls, scrollbars) matches.

https://claude.ai/code/session_01QFB1GtUSutKGZVRnEGkx8X
@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR updates the Tailwind dark mode implementation in globals.css. A custom dark variant is defined to scope dark styling to elements under the .dark class, and color-scheme: dark; is added to signal dark UI styling to the browser.

Changes

Dark Mode Implementation

Layer / File(s) Summary
Class-based dark mode variant
web/src/styles/globals.css
Tailwind dark custom variant definition scoped to .dark class and its descendants, with explicit color-scheme: dark; added to the theme token block.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 Dark mode blooms with just a class,
.dark now reigns where schemes would pass,
Color-scheme declared with pride,
Browser knows the night inside,
A gentle switch, no flicker, no sass!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: forcing dark theme on the web regardless of device color scheme, which matches the CSS modifications and problem being solved.
Description check ✅ Passed The description provides comprehensive context: problem statement, root cause, detailed fix explanation, and verification steps. However, it lacks the structured template sections (Testing, Type, Related Issues) and mentions a Claude Code link rather than following repository standards.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/brave-planck-fgwteq

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@jnahian jnahian self-assigned this Jun 11, 2026
@jnahian
jnahian marked this pull request as ready for review June 11, 2026 04:19
Copilot AI review requested due to automatic review settings June 11, 2026 04:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR ensures the website’s dark theme is applied consistently regardless of the user’s OS/device color scheme by redefining Tailwind’s dark: variant to use the always-present .dark class on the root <html> element, and by aligning native UI rendering with a dark color scheme.

Changes:

  • Override Tailwind v4 dark: behavior to key off .dark (class-based) instead of prefers-color-scheme (media-based).
  • Set color-scheme: dark under .dark so native controls/scrollbars render in dark mode.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
web/src/styles/globals.css (1)

5-5: Stylelint won’t block CI in this repo as-is; this line is fine for Tailwind

  • There’s no stylelint dependency installed (no stylelint/stylelint-config-* in root or web lockfiles) and no stylelint script in either package.json; .stylelintrc.json exists but appears unused by current CI/scripts.
  • @custom-variant dark (&:where(.dark, .dark *)); can stay; only consider ignoreAtRules/rule adjustments if you later enable stylelint for Tailwind v4 at-rules.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@web/src/styles/globals.css` at line 5, The CSS uses the Tailwind v4 at-rule
"`@custom-variant` dark (&:where(.dark, .dark *));" and current CI doesn't run
stylelint, so leave it as-is now; if you enable stylelint later, update the
.stylelintrc.json to either add "ignoreAtRules": ["custom-variant"] or
install/extend a Tailwind-aware config (e.g., stylelint-config-tailwindcss) so
the `@custom-variant` at-rule is accepted, and ensure the rule name
"`@custom-variant`" is whitelisted rather than changing the CSS line itself.

Source: Linters/SAST tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@web/src/styles/globals.css`:
- Line 5: The CSS uses the Tailwind v4 at-rule "`@custom-variant` dark
(&:where(.dark, .dark *));" and current CI doesn't run stylelint, so leave it
as-is now; if you enable stylelint later, update the .stylelintrc.json to either
add "ignoreAtRules": ["custom-variant"] or install/extend a Tailwind-aware
config (e.g., stylelint-config-tailwindcss) so the `@custom-variant` at-rule is
accepted, and ensure the rule name "`@custom-variant`" is whitelisted rather than
changing the CSS line itself.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: aeb0c891-79b1-4561-97bb-e72ee691a5b5

📥 Commits

Reviewing files that changed from the base of the PR and between 72af6ec and f6053db.

📒 Files selected for processing (1)
  • web/src/styles/globals.css

@jnahian
jnahian merged commit b24a46e into main Jun 11, 2026
4 checks passed
@jnahian
jnahian deleted the claude/brave-planck-fgwteq branch June 11, 2026 04:27
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.

3 participants