diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2022-08-27 00:39:59 +0900 |
|---|---|---|
| committer | syuilo <Syuilotan@yahoo.co.jp> | 2022-08-27 00:39:59 +0900 |
| commit | 773139b737fa5c7a597c78abbb39675964343075 (patch) | |
| tree | a28ace988d19e12e89d456b92e72c8fbf0668029 /packages/client/src/scripts | |
| parent | update deps (diff) | |
| download | sharkey-773139b737fa5c7a597c78abbb39675964343075.tar.gz sharkey-773139b737fa5c7a597c78abbb39675964343075.tar.bz2 sharkey-773139b737fa5c7a597c78abbb39675964343075.zip | |
enhance(client): add html color-schema support
Diffstat (limited to 'packages/client/src/scripts')
| -rw-r--r-- | packages/client/src/scripts/theme.ts | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/packages/client/src/scripts/theme.ts b/packages/client/src/scripts/theme.ts index 02ac77b59d..3f55d9ae86 100644 --- a/packages/client/src/scripts/theme.ts +++ b/packages/client/src/scripts/theme.ts @@ -57,6 +57,8 @@ export function applyTheme(theme: Theme, persist = true) { document.documentElement.classList.remove('_themeChanging_'); }, 1000); + const colorSchema = theme.base === 'dark' ? 'dark' : 'light'; + // Deep copy const _theme = JSON.parse(JSON.stringify(theme)); @@ -78,8 +80,11 @@ export function applyTheme(theme: Theme, persist = true) { document.documentElement.style.setProperty(`--${k}`, v.toString()); } + document.documentElement.style.setProperty('color-schema', colorSchema); + if (persist) { localStorage.setItem('theme', JSON.stringify(props)); + localStorage.setItem('colorSchema', colorSchema); } // 色計算など再度行えるようにクライアント全体に通知 |