Add Settings panel with a button to change themes

Only 2 themes besides the default are implemented for now.
More to come!
This commit is contained in:
Stephen Jianu 2023-12-31 16:29:17 -06:00
commit 729c71fac0
6 changed files with 74 additions and 8 deletions

View file

@ -0,0 +1,22 @@
'use strict'
function Settings () {
this.element = null
this.theme_button = null
this.install = function () {
this.element = document.createElement('div')
this.element.setAttribute('class', 'settings')
this.theme_button = document.createElement('select')
this.theme_button.setAttribute('class', 'theme button')
this.theme_button.innerHTML = '<option value=\"theme\">Theme (default)</option>'
this.theme_button.innerHTML += '<option value=\"gameboy\">Game Boy</option>'
this.theme_button.innerHTML += '<option value=\"nightowl\">Night Owl</option>'
this.theme_button.addEventListener('mousedown', () => { donsol.player.change_theme(this.theme_button.value) })
this.element.appendChild(this.theme_button)
return this.element
}
}