Skip to content

fix: Resolve Dual Dark Mode Conflict — Unify to CSS Variables (#693)#999

Merged
magic-peach merged 1 commit into
magic-peach:mainfrom
Abhi190702:fix/dark-mode-consistency-issue-693
May 23, 2026
Merged

fix: Resolve Dual Dark Mode Conflict — Unify to CSS Variables (#693)#999
magic-peach merged 1 commit into
magic-peach:mainfrom
Abhi190702:fix/dark-mode-consistency-issue-693

Conversation

@Abhi190702
Copy link
Copy Markdown
Contributor

Summary

Fixes #693 — Two conflicting dark mode systems produced different background shades depending on which code path ran first.

Root Cause

The project had two active dark mode systems:

  1. CSS variables via .dark class in globals.css (--bg: #0f172a)
  2. Tailwind dark: utility classes (dark:bg-slate-900, dark:bg-gray-800)

These produced visually different shades, making the UI look inconsistent on hard refresh vs. theme toggle.

Changes Made

src/app/globals.css

  • Verified and completed both :root (light) and .dark variable definitions

src/app/layout.tsx

  • Added synchronous inline script in <head> before resource hints to apply theme class before first paint

src/components/ThemeProvider.tsx

  • Ensured dark class is toggled only on <html> / document.documentElement
  • Removed duplicate high-contrast cycle from the dark mode toggle path
  • Single source of truth: localStorage key theme with light / dark

src/components/ThemeToggle.tsx

  • Cleaned up to use the provider state derived from document.documentElement
  • Removed all dark: utility classes from its markup

src/components and src/app

  • Replaced Tailwind dark: color utilities with CSS variable classes like bg-[var(--bg)], bg-[var(--surface)], text-[var(--text)], text-[var(--muted)], and border-[var(--border)]
  • Collapsed light/dark class pairs into single CSS variable classes
  • Zero dark: utilities remain in src/components or src/app TS/TSX files

Tests

  • Updated the ThemeToggle test expectation for the new light/dark-only toggle cycle

Result

  • Hard refresh in dark mode and toggling into dark mode now use the same CSS variable background (#0f172a)
  • One dark mode styling source: CSS variables
  • No Tailwind dark: color utilities remain in component/page TSX files

Testing

  • bun run lint
  • bunx tsc --noEmit
  • bun run build
  • rg "dark:" src/components src/app --glob "*.tsx" --glob "*.ts" returns zero results ✅

Note: A screen recording showing stable dark mode toggling is required per CONTRIBUTING.md. Please attach before merge review.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 23, 2026

Someone is attempting to deploy a commit to the magic-peach1's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added level:advanced Advanced level - 55 pts type:bug Bug fix type:design UI/UX design type:testing Testing labels May 23, 2026
@github-actions
Copy link
Copy Markdown
Contributor

✅ PR Format Check Passed — @Abhi190702

Basic format checks passed. A maintainer will review your code changes.

This does not mean the PR is approved — it just means the format is correct.

@github-actions
Copy link
Copy Markdown
Contributor

👋 Thanks for your PR, @Abhi190702!

Welcome to Reframe — a browser-based video editor built for everyone 🎬

What happens next

  1. 🤖 Automated checks — build & TypeScript typecheck will run automatically
  2. Vercel preview — a preview deployment will be created (requires maintainer authorization for fork PRs)
  3. 👀 Code review — a maintainer will review your changes
  4. 🚀 Merge — once approved, your PR will be merged!

Quick checklist

  • PR title follows Conventional Commits (e.g. feat: add dark mode)
  • Linked the issue this PR closes (e.g. Closes #123)
  • Tested the changes locally (bun run dev)
  • Build passes (bun run build)

Useful links

Happy coding! 🎉

@vercel
Copy link
Copy Markdown

vercel Bot commented May 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
reframe Ready Ready Preview, Comment May 23, 2026 8:11am

@magic-peach magic-peach added gssoc:approved Approved for GSSoC'26 quality:clean Well-implemented, clean code labels May 23, 2026
@Abhi190702
Copy link
Copy Markdown
Contributor Author

@magic-peach , Hey I would be grateful If you could look onto this

@magic-peach magic-peach merged commit 5f234fc into magic-peach:main May 23, 2026
12 checks passed
@magic-peach
Copy link
Copy Markdown
Owner

@Abhi190702 please star the repo

chavanGaneshDatta pushed a commit to chavanGaneshDatta/reframe that referenced this pull request May 23, 2026
…rk: utilities (magic-peach#693) (magic-peach#999)

Co-authored-by: zack34567 <varun.ch@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved Approved for GSSoC'26 level:advanced Advanced level - 55 pts quality:clean Well-implemented, clean code type:bug Bug fix type:design UI/UX design type:testing Testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: two conflicting dark modes — CSS variable dark mode and Tailwind dark: utilities produce different backgrounds

2 participants