style(ui): Visuelles High-End Overhaul fuer Cinematic Cinema OS (3D Spin-Disc, Hero Banner, Radial Gauges & Poster Grid)
Ampel / ampel (push) Successful in 27s
Ampel / ampel (push) Successful in 27s
This commit is contained in:
@@ -10,18 +10,18 @@ interface ThemeContextType {
|
||||
const ThemeContext = createContext<ThemeContextType | undefined>(undefined)
|
||||
|
||||
export function ThemeProvider({ children }: { children: ReactNode }) {
|
||||
const [theme, setTheme] = useState<Theme>('light')
|
||||
const [theme, setTheme] = useState<Theme>('dark')
|
||||
|
||||
useEffect(() => {
|
||||
const savedTheme = localStorage.getItem('theme')
|
||||
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches
|
||||
const savedTheme = localStorage.getItem('theme') as Theme | null
|
||||
const prefersLight = window.matchMedia('(prefers-color-scheme: light)').matches
|
||||
|
||||
if (savedTheme === 'dark' || (!savedTheme && prefersDark)) {
|
||||
setTheme('dark')
|
||||
document.documentElement.classList.add('dark')
|
||||
} else {
|
||||
if (savedTheme === 'light' || (!savedTheme && prefersLight)) {
|
||||
setTheme('light')
|
||||
document.documentElement.classList.remove('dark')
|
||||
} else {
|
||||
setTheme('dark')
|
||||
document.documentElement.classList.add('dark')
|
||||
}
|
||||
}, [])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user