mirror of
https://github.com/GiriNeko/YesPlayMusic.git
synced 2025-12-16 21:28:06 +00:00
feat: updates
This commit is contained in:
parent
0b4baa3eff
commit
222fb02355
77 changed files with 654 additions and 551 deletions
|
|
@ -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')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue