You've already forked AstralRinth
forked from didirus/AstralRinth
* Analytics + more bug fixes * debug deadlock * Fix mostly everything * merge fixes * fix rest * final fixeS
25 lines
769 B
JavaScript
25 lines
769 B
JavaScript
import { defineStore } from 'pinia'
|
|
|
|
export const useTheming = defineStore('themeStore', {
|
|
state: () => ({
|
|
themeOptions: ['dark'],
|
|
collapsedNavigation: false,
|
|
advancedRendering: true,
|
|
selectedTheme: 'dark',
|
|
darkTheme: true,
|
|
}),
|
|
actions: {
|
|
setThemeState(newTheme) {
|
|
if (this.themeOptions.includes(newTheme)) this.selectedTheme = newTheme
|
|
else console.warn('Selected theme is not present. Check themeOptions.')
|
|
|
|
this.setThemeClass()
|
|
},
|
|
setThemeClass() {
|
|
document.getElementsByTagName('html')[0].classList.remove('dark-mode')
|
|
document.getElementsByTagName('html')[0].classList.remove('light-mode')
|
|
document.getElementsByTagName('html')[0].classList.add(`${this.selectedTheme}-mode`)
|
|
},
|
|
},
|
|
})
|