From ad2aad5a649ec78cab744ee41dec4e4cf1eb975c Mon Sep 17 00:00:00 2001 From: AUnicornWithNoLife Date: Sat, 10 Jul 2021 15:29:11 +0100 Subject: [PATCH] comments --- src/theme.js | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/src/theme.js b/src/theme.js index 70d0561..8673114 100755 --- a/src/theme.js +++ b/src/theme.js @@ -2,28 +2,34 @@ class theme { constructor(back, object, highlight, text, win, loose, pre) { - this.back = back; - this.object = object; - this.highlight = highlight; - this.text = text; - this.win = win; - this.loose = loose; - this.predict = pre; + this.back = back; // background + this.object = object; // button color + this.highlight = highlight; // when button is hovered + this.text = text; // text + this.win = win; // win background + this.loose = loose; // loose background + this.predict = pre; // prediction outline } } +// theme definitions + const themes = { - 'orange': new theme('#231F20', '#ec5020', '#fa6d42', '#ffffff', '#9DB17C', '#b86868', '#9DB17C'), - 'greyscale': new theme('#000000', '#555555', '#AAAAAA', '#FFFFFF', '#CCCCCC', '#333333', '#CCCCCC') + 'orange': new theme('#231F20', '#ec5020', '#fa6d42', '#ffffff', '#9DB17C', '#b86868', '#9DB17C'), // main theme + 'greyscale': new theme('#000000', '#555555', '#AAAAAA', '#FFFFFF', '#CCCCCC', '#333333', '#CCCCCC') // test theme, but not too bad lol } +// once theme has been added to themes, add it here so it is added to the onscreen picker + const themenames = [ 'orange', 'greyscale' ] +// setup the onscreen theme selector + function setupTheme() { themenames.forEach(function(val) @@ -35,11 +41,15 @@ function setupTheme() }); } +// update scene from onscreen scene selector + function updateTheme() { setTheme(themesel.options[themesel.selectedIndex].value); } +// set scene data in CSS + function setTheme(name) { root.style.setProperty('--theme-back', themes[name].back);