Files
AstralRinth/theseus_gui/src/store/theme.js
T
Adrian O.V c79d5c32a6 Bring back the old nav (#100)
* Bring back the old nav

* Added bool to settings

* settings wireup

* Fixy fix

* fix create btn

---------

Co-authored-by: thesuzerain <wverchere@gmail.com>
Co-authored-by: Jai A <jaiagr+gpg@pm.me>
2023-05-05 15:37:23 -07:00

24 lines
749 B
JavaScript

import { defineStore } from 'pinia'
export const useTheming = defineStore('themeStore', {
state: () => ({
themeOptions: ['light', 'dark'],
collapsedNavigation: false,
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`)
},
},
})