Skip to content

Commit ff27fb6

Browse files
committed
fix: adjust broken system light theme change
1 parent 488244e commit ff27fb6

3 files changed

Lines changed: 28 additions & 1 deletion

File tree

src/components/theme-switcher.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ export function ThemeSwitcher() {
4444
function cycle() {
4545
const idx = THEMES.findIndex((themeOption) => themeOption.value === theme);
4646
const next = THEMES[(idx + 1) % THEMES.length].value;
47+
4748
setTheme(next);
4849
applyTheme(next);
4950

src/styles/global.css

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,31 @@
9292
--color-legendary-border: #fde68a;
9393
}
9494

95+
[data-theme='dark'] {
96+
--color-bg: #0f0f0e;
97+
--color-border: #2e2c28;
98+
--color-surface: #1a1917;
99+
--color-surface-raised: #242320;
100+
--color-text: #f0efe8;
101+
--color-text-muted: #9c9a92;
102+
--color-text-faint: #6b6860;
103+
--color-accent: #7c6cf5;
104+
--color-accent-hover: #9585f7;
105+
--color-accent-subtle: #1e1a3d;
106+
--color-common: #a1a1aa;
107+
--color-common-bg: #27272a;
108+
--color-common-border: #3f3f46;
109+
--color-rare: #60a5fa;
110+
--color-rare-bg: #172554;
111+
--color-rare-border: #1e3a8a;
112+
--color-epic: #a78bfa;
113+
--color-epic-bg: #1e0a3c;
114+
--color-epic-border: #4c1d95;
115+
--color-legendary: #fbbf24;
116+
--color-legendary-bg: #1c1102;
117+
--color-legendary-border: #78350f;
118+
}
119+
95120
*,
96121
*::before,
97122
*::after {

src/test/theme-switcher.test.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import { ThemeSwitcher } from '@/components/theme-switcher';
22
import { render, screen, fireEvent } from '@testing-library/react';
3-
import { describe, test, expect, beforeEach, afterEach } from 'vitest';
3+
import { describe, test, expect, vi, beforeEach, afterEach } from 'vitest';
44

55
function getTheme() {
66
return document.documentElement.getAttribute('data-theme');
77
}
88

99
beforeEach(() => {
10+
vi.clearAllMocks();
1011
localStorage.clear();
1112
document.documentElement.removeAttribute('data-theme');
1213
});

0 commit comments

Comments
 (0)