Commit 5a518572 authored by Grandschtroumpf's avatar Grandschtroumpf Committed by yann300

Switch theme without reload

parent b1f3a8c3
...@@ -142,15 +142,15 @@ module.exports = class SettingsTab { ...@@ -142,15 +142,15 @@ module.exports = class SettingsTab {
} }
function onswitch2darkTheme (event) { function onswitch2darkTheme (event) {
styleGuide.switchTheme('dark') styleGuide.switchTheme('dark')
window.location.reload() // window.location.reload()
} }
function onswitch2lightTheme (event) { function onswitch2lightTheme (event) {
styleGuide.switchTheme('light') styleGuide.switchTheme('light')
window.location.reload() // window.location.reload()
} }
function onswitch2cleanTheme (event) { function onswitch2cleanTheme (event) {
styleGuide.switchTheme('clean') styleGuide.switchTheme('clean')
window.location.reload() // window.location.reload()
} }
function onchangePersonal (event) { function onchangePersonal (event) {
self._deps.config.set('settings/personal-mode', !self._deps.config.get('settings/personal-mode')) self._deps.config.set('settings/personal-mode', !self._deps.config.get('settings/personal-mode'))
......
...@@ -33,8 +33,10 @@ module.exports = { ...@@ -33,8 +33,10 @@ module.exports = {
switchTheme: function (theme) { switchTheme: function (theme) {
var themeStorage = new Storage('style:') var themeStorage = new Storage('style:')
console.log(document)
themeStorage.set('theme', theme) themeStorage.set('theme', theme)
if (themes[theme]) {
document.getElementById('theme-link').setAttribute('href', themes[theme])
}
// if (theme === 'dark') { // if (theme === 'dark') {
// return styleGuideDark() // return styleGuideDark()
// } else if (theme === 'light') { // } else if (theme === 'light') {
...@@ -44,19 +46,5 @@ module.exports = { ...@@ -44,19 +46,5 @@ module.exports = {
// } else { // } else {
// return styleGuideLight() // return styleGuideLight()
// } // }
// // Boostrap themes
// // TODO : Put it somewhere else
// const themes = {
// dark: 'https://bootstrap.themes.guide/darkster/theme.min.css',
// light: 'https://bootstrap.themes.guide/herbie/theme.min.css',
// clean: 'https://bootstrap.themes.guide/signal/theme.min.css'
// }
// if (themes[theme]) {
// document.getElementById('theme-link').setAttribute('href', themes[theme])
// }
// else {
// document.getElementById('theme-link').setProperty('href', themes['light'])
// }
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment