mirror of
https://github.com/saicaca/fuwari.git
synced 2026-01-11 14:52:52 +01:00
fix: load stored theme before rendering
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import {AUTO_MODE, DARK_MODE, DEFAULT_THEME, LIGHT_MODE} from "@constants/constants.ts";
|
||||
|
||||
export function getDefaultHue(): number {
|
||||
const fallback = '250'
|
||||
const configCarrier = document.getElementById('config-carrier')
|
||||
@@ -18,8 +20,6 @@ export function setHue(hue: number): void {
|
||||
r.style.setProperty('--hue', hue)
|
||||
}
|
||||
|
||||
export const LIGHT_MODE = 'light', DARK_MODE = 'dark', AUTO_MODE = 'auto'
|
||||
|
||||
export function setTheme(theme: string): void {
|
||||
localStorage.setItem('theme', theme)
|
||||
switch (theme) {
|
||||
@@ -40,5 +40,5 @@ export function setTheme(theme: string): void {
|
||||
}
|
||||
|
||||
export function getStoredTheme(): string {
|
||||
return localStorage.getItem('theme') || AUTO_MODE
|
||||
return localStorage.getItem('theme') || DEFAULT_THEME
|
||||
}
|
||||
Reference in New Issue
Block a user