feat: updates

This commit is contained in:
qier222 2022-07-11 11:06:41 +08:00
parent 0b4baa3eff
commit 222fb02355
No known key found for this signature in database
GPG key ID: 9C85007ED905F14D
77 changed files with 654 additions and 551 deletions

View file

@ -1,8 +1,17 @@
export const changeTheme = (theme: 'light' | 'dark') => {
document.body.setAttribute('class', theme)
if (!window.env?.isElectron) {
document.documentElement.style.background =
theme === 'dark' ? '#000' : '#fff'
}
}
export const changeAccentColor = (color: string) => {
document.body.setAttribute('data-accent-color', color)
}
const stateString = localStorage.getItem('state')
const stateInLocalStorage = stateString ? JSON.parse(stateString) : {}
const settingsInStorage = localStorage.getItem('settings')
const settings = settingsInStorage ? JSON.parse(settingsInStorage) : {}
changeAccentColor(stateInLocalStorage?.settings?.accentColor || 'blue')
changeTheme(settings.theme || 'dark')
changeAccentColor(settings?.accentColor || 'green')