Add themeVariable for scrollbar

pull/1/head
Grandschtroumpf 6 years ago committed by yann300
parent f8c7308cb6
commit fe31351575
  1. 11
      src/app/ui/styles-guide/theme-chooser.js

@ -10,6 +10,12 @@ const themes = {
light: 'https://bootstrap.themes.guide/herbie/theme.min.css', light: 'https://bootstrap.themes.guide/herbie/theme.min.css',
clean: 'https://bootstrap.themes.guide/signal/theme.min.css' clean: 'https://bootstrap.themes.guide/signal/theme.min.css'
} }
// Used for the scroll color
const themeVariable = {
dark: 'dark',
light: 'light',
clean: 'light'
}
module.exports = { module.exports = {
chooser: function () { chooser: function () {
@ -17,16 +23,20 @@ module.exports = {
if (themeStorage.exists('theme')) { if (themeStorage.exists('theme')) {
if (themeStorage.get('theme') === 'dark') { if (themeStorage.get('theme') === 'dark') {
document.getElementById('theme-link').setAttribute('href', themes['dark']) document.getElementById('theme-link').setAttribute('href', themes['dark'])
document.documentElement.style.setProperty('--theme', 'dark')
return styleGuideDark() return styleGuideDark()
} else if (themeStorage.get('theme') === 'clean') { } else if (themeStorage.get('theme') === 'clean') {
document.getElementById('theme-link').setAttribute('href', themes['clean']) document.getElementById('theme-link').setAttribute('href', themes['clean'])
document.documentElement.style.setProperty('--theme', 'light')
return styleGuideClean() return styleGuideClean()
} else { } else {
document.getElementById('theme-link').setAttribute('href', themes['light']) document.getElementById('theme-link').setAttribute('href', themes['light'])
document.documentElement.style.setProperty('--theme', 'light')
return styleGuideLight() return styleGuideLight()
} }
} else { } else {
document.getElementById('theme-link').setAttribute('href', themes['light']) document.getElementById('theme-link').setAttribute('href', themes['light'])
document.documentElement.style.setProperty('--theme', 'light')
return styleGuideLight() return styleGuideLight()
} }
}, },
@ -36,6 +46,7 @@ module.exports = {
themeStorage.set('theme', theme) themeStorage.set('theme', theme)
if (themes[theme]) { if (themes[theme]) {
document.getElementById('theme-link').setAttribute('href', themes[theme]) document.getElementById('theme-link').setAttribute('href', themes[theme])
document.documentElement.style.setProperty('--theme', themeVariable[theme])
} }
// if (theme === 'dark') { // if (theme === 'dark') {
// return styleGuideDark() // return styleGuideDark()

Loading…
Cancel
Save