Skip to content

Commit 2a7777d

Browse files
feat: add light/dark theme toggle
- Implement theme state management - Add CSS variables for both light and dark modes - Create theme toggle button with Moon/Sun icons - Sync Monaco editor theme with app theme - Default to light theme with easy switching
1 parent 3cbb136 commit 2a7777d

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

src/index.css

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,41 @@
44
@custom-variant dark (&:is(.dark *));
55

66
:root {
7+
--background: oklch(0.98 0 0);
8+
--foreground: oklch(0.15 0 0);
9+
--card: oklch(1 0 0);
10+
--card-foreground: oklch(0.15 0 0);
11+
--popover: oklch(1 0 0);
12+
--popover-foreground: oklch(0.15 0 0);
13+
--primary: oklch(0.45 0.15 220);
14+
--primary-foreground: oklch(0.98 0 0);
15+
--secondary: oklch(0.92 0 0);
16+
--secondary-foreground: oklch(0.15 0 0);
17+
--muted: oklch(0.92 0 0);
18+
--muted-foreground: oklch(0.45 0 0);
19+
--accent: oklch(0.95 0 0);
20+
--accent-foreground: oklch(0.15 0 0);
21+
--destructive: oklch(0.55 0.22 25);
22+
--destructive-foreground: oklch(0.98 0 0);
23+
--border: oklch(0.88 0 0);
24+
--input: oklch(0.96 0 0);
25+
--ring: oklch(0.45 0.15 220);
26+
--radius: 0.375rem;
27+
--sidebar: oklch(0.97 0 0);
28+
--sidebar-foreground: oklch(0.25 0 0);
29+
--sidebar-primary: oklch(0.45 0.15 220);
30+
--sidebar-primary-foreground: oklch(0.98 0 0);
31+
--sidebar-accent: oklch(0.94 0 0);
32+
--sidebar-accent-foreground: oklch(0.15 0 0);
33+
--sidebar-border: oklch(0.88 0 0);
34+
--sidebar-ring: oklch(0.45 0.15 220);
35+
--success: oklch(0.45 0.18 150);
36+
--warning: oklch(0.55 0.18 85);
37+
--editor-bg: oklch(0.99 0 0);
38+
--editor-line: oklch(0.96 0 0);
39+
}
40+
41+
.dark {
742
--background: oklch(0.12 0 0);
843
--foreground: oklch(0.95 0 0);
944
--card: oklch(0.15 0 0);
@@ -23,7 +58,6 @@
2358
--border: oklch(0.25 0 0);
2459
--input: oklch(0.22 0 0);
2560
--ring: oklch(0.75 0.15 220);
26-
--radius: 0.375rem;
2761
--sidebar: oklch(0.1 0 0);
2862
--sidebar-foreground: oklch(0.85 0 0);
2963
--sidebar-primary: oklch(0.75 0.15 220);

0 commit comments

Comments
 (0)