Task: Theme System with CSS Variables and Pre-built Themes
Description
Implement a centralized theme system using CSS variables and React Context. Create 4-5 pre-built themes (Dark Pro, Nord, Dracula, Monokai) and complete dark mode polish to eliminate all light-mode artifacts. This is the foundation task that enables all visual work.
Acceptance Criteria
Technical Details
Implementation Approach
Central theme in packages/ui (shared by web + desktop):
- Create
packages/ui/src/theme/ThemeProvider.tsx with theme state and switching logic
- Define theme presets in
packages/ui/src/theme/themes.ts:
- Dark Pro (default), Nord, Dracula, Monokai
- Inject CSS variables into document root via ThemeProvider
- Extend existing
packages/ui/src/theme.ts (Mantine config) to use CSS variables
- Export ThemeProvider and hooks from
packages/ui
Web app (apps/web):
6. Update apps/web/src/app/[locale]/layout.tsx to wrap with ThemeProvider
7. Audit all apps/web/src/components/ for hardcoded colors
Desktop app (apps/desktop):
8. Update desktop's root layout to wrap with ThemeProvider from @trevo/ui
9. Verify all desktop components render correctly with theme system
Landing page (apps/landing):
10. Add Tailwind CSS variables for consistent branding (independent from Mantine)
11. Ensure landing visuals align with main app's design language
Key Considerations
- Use semantic color names (e.g.,
--color-bg-primary, --color-text-heading) not literal colors
- Ensure proper contrast ratios (WCAG AA minimum)
- Test theme switching doesn't cause flash of unstyled content
- Custom scrollbar styling for each theme
Files Affected
packages/ui (central theme):
packages/ui/src/theme/ThemeProvider.tsx (new)
packages/ui/src/theme/themes.ts (new - theme presets)
packages/ui/src/theme.ts (modify - extend Mantine config)
packages/ui/src/index.ts (modify - export ThemeProvider + hooks)
apps/web:
apps/web/src/app/[locale]/layout.tsx (modify - wrap with ThemeProvider)
apps/web/src/providers/MantineProvider.tsx (modify to use theme context)
apps/web/tailwind.config.ts (extend with CSS variable references)
- All component files in
apps/web/src/components/ (audit for hardcoded colors)
apps/desktop:
- Desktop root layout (modify - wrap with ThemeProvider)
apps/desktop/tailwind.config.ts (extend with CSS variable references)
- Desktop components (audit for hardcoded colors)
apps/landing:
apps/landing/tailwind.config.ts (add brand CSS variables)
- Landing components (align visual style)
Dependencies
Effort Estimate
- Size: M (Medium)
- Hours: 16-22 hours (expanded to cover 3 apps + shared package)
- Parallel: true (no dependencies, can start immediately)
Definition of Done
Task: Theme System with CSS Variables and Pre-built Themes
Description
Implement a centralized theme system using CSS variables and React Context. Create 4-5 pre-built themes (Dark Pro, Nord, Dracula, Monokai) and complete dark mode polish to eliminate all light-mode artifacts. This is the foundation task that enables all visual work.
Acceptance Criteria
Technical Details
Implementation Approach
Central theme in
packages/ui(shared by web + desktop):packages/ui/src/theme/ThemeProvider.tsxwith theme state and switching logicpackages/ui/src/theme/themes.ts:packages/ui/src/theme.ts(Mantine config) to use CSS variablespackages/uiWeb app (
apps/web):6. Update
apps/web/src/app/[locale]/layout.tsxto wrap with ThemeProvider7. Audit all
apps/web/src/components/for hardcoded colorsDesktop app (
apps/desktop):8. Update desktop's root layout to wrap with ThemeProvider from
@trevo/ui9. Verify all desktop components render correctly with theme system
Landing page (
apps/landing):10. Add Tailwind CSS variables for consistent branding (independent from Mantine)
11. Ensure landing visuals align with main app's design language
Key Considerations
--color-bg-primary,--color-text-heading) not literal colorsFiles Affected
packages/ui (central theme):
packages/ui/src/theme/ThemeProvider.tsx(new)packages/ui/src/theme/themes.ts(new - theme presets)packages/ui/src/theme.ts(modify - extend Mantine config)packages/ui/src/index.ts(modify - export ThemeProvider + hooks)apps/web:
apps/web/src/app/[locale]/layout.tsx(modify - wrap with ThemeProvider)apps/web/src/providers/MantineProvider.tsx(modify to use theme context)apps/web/tailwind.config.ts(extend with CSS variable references)apps/web/src/components/(audit for hardcoded colors)apps/desktop:
apps/desktop/tailwind.config.ts(extend with CSS variable references)apps/landing:
apps/landing/tailwind.config.ts(add brand CSS variables)Dependencies
Effort Estimate
Definition of Done