make themes work again

This commit is contained in:
2017-09-10 15:21:18 +02:00
parent 086532ff4c
commit 87ed5491a4
+9 -8
View File
@@ -95,7 +95,7 @@ class TermScreen {
blinkInterval: 0
}
this._palette = themes[0]
this._palette = null
this._window = {
width: 0,
@@ -359,7 +359,10 @@ class TermScreen {
}
}
get palette () { return this._palette }
get palette () {
return this._palette || themes[0]
}
set palette (palette) {
this._palette = palette
this.scheduleDraw()
@@ -965,8 +968,11 @@ class TermScreen {
}
}
load (str) {
load (str, theme = -1) {
const content = str.substr(1)
if (theme >= 0 && theme < themes.length) {
Screen.palette = themes[theme]
}
switch (str[0]) {
case 'S':
@@ -1034,11 +1040,6 @@ const Screen = new TermScreen()
Screen.once('load', () => {
qs('#screen').appendChild(Screen.canvas)
for (let item of qs('#screen').classList) {
if (item.startsWith('theme-')) {
Screen.colors = themes[item.substr(6)]
}
}
})
let fitScreen = false