Files
AstralRinth/theseus_gui/src/store/theme.js
Adrian O.V 4941260805 Fixes and enhancements (#350)
* Fixes #147

* Fixes #149 and #151

* Fixed #153

* Fixes #154

* Update ContextMenu.vue

* Revert temp change to test windows

* More bug fixes

* Fixed modpack install bug

* Fixes #314

* Lint

* Fix #261
2023-07-21 14:59:34 -07:00

24 lines
737 B
JavaScript

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