|
25 | 25 | --color-input: var(--input); |
26 | 26 | --color-border: var(--border); |
27 | 27 | --color-destructive: var(--destructive); |
| 28 | + --color-destructive-foreground: var(--destructive-foreground); |
28 | 29 | --color-accent-foreground: var(--accent-foreground); |
29 | 30 | --color-accent: var(--accent); |
30 | 31 | --color-muted-foreground: var(--muted-foreground); |
|
45 | 46 |
|
46 | 47 | :root { |
47 | 48 | --radius: 0.625rem; |
| 49 | + |
| 50 | + /* Light mode colors */ |
48 | 51 | --background: oklch(1 0 0); |
49 | 52 | --foreground: oklch(0.145 0 0); |
50 | 53 | --card: oklch(1 0 0); |
|
60 | 63 | --accent: oklch(0.97 0 0); |
61 | 64 | --accent-foreground: oklch(0.205 0 0); |
62 | 65 | --destructive: oklch(0.577 0.245 27.325); |
| 66 | + --destructive-foreground: oklch(0.985 0 0); |
63 | 67 | --border: oklch(0.922 0 0); |
64 | 68 | --input: oklch(0.922 0 0); |
65 | 69 | --ring: oklch(0.708 0 0); |
|
78 | 82 | --sidebar-ring: oklch(0.708 0 0); |
79 | 83 | } |
80 | 84 |
|
81 | | -.dark { |
| 85 | +/* Apply dark colors by default if system prefers dark AND no explicit theme is set */ |
| 86 | +@media (prefers-color-scheme: dark) { |
| 87 | + html:not(.light):not(.dark) { |
| 88 | + --background: oklch(0.145 0 0); |
| 89 | + --foreground: oklch(0.985 0 0); |
| 90 | + --card: oklch(0.205 0 0); |
| 91 | + --card-foreground: oklch(0.985 0 0); |
| 92 | + --popover: oklch(0.205 0 0); |
| 93 | + --popover-foreground: oklch(0.985 0 0); |
| 94 | + --primary: oklch(0.922 0 0); |
| 95 | + --primary-foreground: oklch(0.205 0 0); |
| 96 | + --secondary: oklch(0.269 0 0); |
| 97 | + --secondary-foreground: oklch(0.985 0 0); |
| 98 | + --muted: oklch(0.269 0 0); |
| 99 | + --muted-foreground: oklch(0.708 0 0); |
| 100 | + --accent: oklch(0.269 0 0); |
| 101 | + --accent-foreground: oklch(0.985 0 0); |
| 102 | + --destructive: oklch(0.704 0.191 22.216); |
| 103 | + --destructive-foreground: oklch(0.985 0 0); |
| 104 | + --border: oklch(1 0 0 / 10%); |
| 105 | + --input: oklch(1 0 0 / 15%); |
| 106 | + --ring: oklch(0.556 0 0); |
| 107 | + --chart-1: oklch(0.488 0.243 264.376); |
| 108 | + --chart-2: oklch(0.696 0.17 162.48); |
| 109 | + --chart-3: oklch(0.769 0.188 70.08); |
| 110 | + --chart-4: oklch(0.627 0.265 303.9); |
| 111 | + --chart-5: oklch(0.645 0.246 16.439); |
| 112 | + --sidebar: oklch(0.205 0 0); |
| 113 | + --sidebar-foreground: oklch(0.985 0 0); |
| 114 | + --sidebar-primary: oklch(0.488 0.243 264.376); |
| 115 | + --sidebar-primary-foreground: oklch(0.985 0 0); |
| 116 | + --sidebar-accent: oklch(0.269 0 0); |
| 117 | + --sidebar-accent-foreground: oklch(0.985 0 0); |
| 118 | + --sidebar-border: oklch(1 0 0 / 10%); |
| 119 | + --sidebar-ring: oklch(0.556 0 0); |
| 120 | + } |
| 121 | +} |
| 122 | + |
| 123 | +/* Explicit light mode - overrides system preference */ |
| 124 | +html.light, |
| 125 | +:root.light { |
| 126 | + --background: oklch(1 0 0); |
| 127 | + --foreground: oklch(0.145 0 0); |
| 128 | + --card: oklch(1 0 0); |
| 129 | + --card-foreground: oklch(0.145 0 0); |
| 130 | + --popover: oklch(1 0 0); |
| 131 | + --popover-foreground: oklch(0.145 0 0); |
| 132 | + --primary: oklch(0.205 0 0); |
| 133 | + --primary-foreground: oklch(0.985 0 0); |
| 134 | + --secondary: oklch(0.97 0 0); |
| 135 | + --secondary-foreground: oklch(0.205 0 0); |
| 136 | + --muted: oklch(0.97 0 0); |
| 137 | + --muted-foreground: oklch(0.556 0 0); |
| 138 | + --accent: oklch(0.97 0 0); |
| 139 | + --accent-foreground: oklch(0.205 0 0); |
| 140 | + --destructive: oklch(0.577 0.245 27.325); |
| 141 | + --destructive-foreground: oklch(0.985 0 0); |
| 142 | + --border: oklch(0.922 0 0); |
| 143 | + --input: oklch(0.922 0 0); |
| 144 | + --ring: oklch(0.708 0 0); |
| 145 | + --chart-1: oklch(0.646 0.222 41.116); |
| 146 | + --chart-2: oklch(0.6 0.118 184.704); |
| 147 | + --chart-3: oklch(0.398 0.07 227.392); |
| 148 | + --chart-4: oklch(0.828 0.189 84.429); |
| 149 | + --chart-5: oklch(0.769 0.188 70.08); |
| 150 | + --sidebar: oklch(0.985 0 0); |
| 151 | + --sidebar-foreground: oklch(0.145 0 0); |
| 152 | + --sidebar-primary: oklch(0.205 0 0); |
| 153 | + --sidebar-primary-foreground: oklch(0.985 0 0); |
| 154 | + --sidebar-accent: oklch(0.97 0 0); |
| 155 | + --sidebar-accent-foreground: oklch(0.205 0 0); |
| 156 | + --sidebar-border: oklch(0.922 0 0); |
| 157 | + --sidebar-ring: oklch(0.708 0 0); |
| 158 | +} |
| 159 | + |
| 160 | +/* Explicit dark mode */ |
| 161 | +html.dark, |
| 162 | +:root.dark { |
82 | 163 | --background: oklch(0.145 0 0); |
83 | 164 | --foreground: oklch(0.985 0 0); |
84 | 165 | --card: oklch(0.205 0 0); |
|
94 | 175 | --accent: oklch(0.269 0 0); |
95 | 176 | --accent-foreground: oklch(0.985 0 0); |
96 | 177 | --destructive: oklch(0.704 0.191 22.216); |
| 178 | + --destructive-foreground: oklch(0.985 0 0); |
97 | 179 | --border: oklch(1 0 0 / 10%); |
98 | 180 | --input: oklch(1 0 0 / 15%); |
99 | 181 | --ring: oklch(0.556 0 0); |
|
113 | 195 | } |
114 | 196 |
|
115 | 197 | @layer base { |
| 198 | + /* Prevent transitions on theme changes to avoid flash */ |
| 199 | + html, body { |
| 200 | + transition: none !important; |
| 201 | + } |
| 202 | + |
116 | 203 | * { |
117 | 204 | @apply border-border outline-ring/50; |
118 | 205 | } |
| 206 | + |
119 | 207 | body { |
120 | 208 | @apply bg-background text-foreground; |
121 | 209 | } |
|
0 commit comments