Reworked the resizer

This commit is contained in:
Devine Lu Linvega
2019-04-22 09:28:31 +09:00
parent 64f5853156
commit d4305f306e
4 changed files with 48 additions and 32 deletions

View File

@@ -29,7 +29,7 @@ function Theme (_default) {
this.load = function (data) {
const theme = parse(data)
if (!validate(theme)) { console.warn('Theme', 'Not a theme', theme); return }
console.log('Theme', `Load theme, background: ${theme.background}.`)
console.log('Theme', `Loaded theme!`)
this.el.innerHTML = `:root { --background: ${theme.background}; --f_high: ${theme.f_high}; --f_med: ${theme.f_med}; --f_low: ${theme.f_low}; --f_inv: ${theme.f_inv}; --b_high: ${theme.b_high}; --b_med: ${theme.b_med}; --b_low: ${theme.b_low}; --b_inv: ${theme.b_inv}; }`
localStorage.setItem('theme', JSON.stringify(theme))
this.active = theme
@@ -125,3 +125,5 @@ function Theme (_default) {
try { new DOMParser().parseFromString(text, 'text/xml'); return true } catch (error) { return false }
}
}
module.exports = Theme