Switch theme without reload

pull/1/head
Grandschtroumpf 6 years ago committed by yann300
parent b1f3a8c390
commit 5a518572e3
  1. 6
      src/app/tabs/settings-tab.js
  2. 18
      src/app/ui/styles-guide/theme-chooser.js

@ -142,15 +142,15 @@ module.exports = class SettingsTab {
}
function onswitch2darkTheme (event) {
styleGuide.switchTheme('dark')
window.location.reload()
// window.location.reload()
}
function onswitch2lightTheme (event) {
styleGuide.switchTheme('light')
window.location.reload()
// window.location.reload()
}
function onswitch2cleanTheme (event) {
styleGuide.switchTheme('clean')
window.location.reload()
// window.location.reload()
}
function onchangePersonal (event) {
self._deps.config.set('settings/personal-mode', !self._deps.config.get('settings/personal-mode'))

@ -33,8 +33,10 @@ module.exports = {
switchTheme: function (theme) {
var themeStorage = new Storage('style:')
console.log(document)
themeStorage.set('theme', theme)
if (themes[theme]) {
document.getElementById('theme-link').setAttribute('href', themes[theme])
}
// if (theme === 'dark') {
// return styleGuideDark()
// } else if (theme === 'light') {
@ -44,19 +46,5 @@ module.exports = {
// } else {
// 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'])
// }
}
}

Loading…
Cancel
Save