make themes work again

cpsdqs/unified-input
Ondřej Hruška 7 years ago
parent 086532ff4c
commit 87ed5491a4
  1. 17
      jssrc/term_screen.js

@ -95,7 +95,7 @@ class TermScreen {
blinkInterval: 0 blinkInterval: 0
} }
this._palette = themes[0] this._palette = null
this._window = { this._window = {
width: 0, width: 0,
@ -359,7 +359,10 @@ class TermScreen {
} }
} }
get palette () { return this._palette } get palette () {
return this._palette || themes[0]
}
set palette (palette) { set palette (palette) {
this._palette = palette this._palette = palette
this.scheduleDraw() this.scheduleDraw()
@ -965,8 +968,11 @@ class TermScreen {
} }
} }
load (str) { load (str, theme = -1) {
const content = str.substr(1) const content = str.substr(1)
if (theme >= 0 && theme < themes.length) {
Screen.palette = themes[theme]
}
switch (str[0]) { switch (str[0]) {
case 'S': case 'S':
@ -1034,11 +1040,6 @@ const Screen = new TermScreen()
Screen.once('load', () => { Screen.once('load', () => {
qs('#screen').appendChild(Screen.canvas) 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 let fitScreen = false

Loading…
Cancel
Save