Skip to content

Config: expose the theme default via env - #1575

Merged
Baskarayelu merged 4 commits into
Remitwise-Org:mainfrom
1nonlypiece:config/1498-theme-default-env
Jul 30, 2026
Merged

Config: expose the theme default via env#1575
Baskarayelu merged 4 commits into
Remitwise-Org:mainfrom
1nonlypiece:config/1498-theme-default-env

Conversation

@1nonlypiece

Copy link
Copy Markdown
Contributor

Summary

The default theme (applied when a visitor has no stored theme-preference yet) was hardcoded to "system" in two places: ThemeContext.tsx's initial state and the inline pre-hydration script in app/layout.tsx. Adds getDefaultThemePreference() (lib/config/theme.ts), reading NEXT_PUBLIC_DEFAULT_THEME and falling back to "system" when unset/invalid, and wires it into both places so they stay in sync (see the "why two copies" note added in #1574's docs/THEMING.md update).

Testing

  • node node_modules/vitest/vitest.mjs run ... tests/unit/config/theme.test.ts tests/unit/context/ThemeContext.test.tsx -- 8/8 pass (3 new)
  • npm run test:unit:vitest -- 300 passing (was 297 on main), zero regressions
  • npx eslint lib/config/theme.ts lib/context/ThemeContext.tsx app/layout.tsx tests/unit/config/theme.test.ts -- clean
  • npx tsc --noEmit -- no new errors in any touched file

Closes #1498

@Baskarayelu
Baskarayelu merged commit b47fff7 into Remitwise-Org:main Jul 30, 2026
7 of 12 checks passed
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.

Config: expose the theme default via env

2 participants