Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions frontend/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -3855,3 +3855,19 @@ button,
white-space: nowrap;
}
}

/* ============================================
Light Theme Overrides
============================================ */
.theme-light {
--bg-primary: #f8f9fa;
--bg-secondary: #ffffff;
--bg-tertiary: #f1f3f5;
--bg-elevated: #e9ecef;
--accent-silver: #6c757d;
--accent-silver-dim: #adb5bd;
--accent-silver-bright: #212529;
--text-primary: #212529;
--text-secondary: #495057;
--text-muted: #6c757d;
}
10 changes: 10 additions & 0 deletions frontend/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
/** @type {import('tailwindcss').Config} */
export default {
darkMode: 'class',
content: [
"./index.html",
"./src/**/*.{js,ts,jsx,tsx}",
],
theme: {
extend: {
colors: {
'primary': 'var(--bg-primary)',
'secondary': 'var(--bg-secondary)',
'bg-primary': 'var(--bg-primary)',
'bg-secondary': 'var(--bg-secondary)',
'bg-tertiary': 'var(--bg-tertiary)',
'bg-elevated': 'var(--bg-elevated)',
'primary-text': 'var(--text-primary)',
'secondary-text': 'var(--text-secondary)',
'muted': 'var(--text-muted)',
'charcoal-dark': '#0a0a0c',
charcoal: {
light: '#1d1d21',
Expand Down
28 changes: 28 additions & 0 deletions frontend/testing/unit/components/ThemeToggle.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,34 @@ describe('ThemeToggle', () => {
expect(button).toHaveAttribute('aria-pressed', 'true')
})

it('applies the dark class to document root and removes theme-light', async () => {
localStorage.setItem(STORAGE_KEY, 'light')
document.documentElement.classList.remove('dark')
document.documentElement.classList.add('theme-light')
const user = userEvent.setup()
renderWithTheme()

const button = screen.getByRole('button')
await user.click(button)

expect(document.documentElement.classList.contains('dark')).toBe(true)
expect(document.documentElement.classList.contains('theme-light')).toBe(false)
})

it('applies the theme-light class to document root and removes dark', async () => {
localStorage.setItem(STORAGE_KEY, 'dark')
document.documentElement.classList.add('dark')
document.documentElement.classList.remove('theme-light')
const user = userEvent.setup()
renderWithTheme()

const button = screen.getByRole('button')
await user.click(button)

expect(document.documentElement.classList.contains('theme-light')).toBe(true)
expect(document.documentElement.classList.contains('dark')).toBe(false)
})

it('aria-label reflects the target theme, not the current one', () => {
localStorage.setItem(STORAGE_KEY, 'dark')
renderWithTheme()
Expand Down
Loading