From 4c490bea16df7a1bb40c13b8b9e9b280b8f34dbb Mon Sep 17 00:00:00 2001 From: ebolam Date: Sun, 21 Aug 2022 17:36:32 -0400 Subject: [PATCH] Palette System Functional --- static/koboldai.js | 11 +++++++---- templates/settings flyout.html | 36 +++++++++++++++++----------------- themes/Monochrome.css | 3 ++- 3 files changed, 27 insertions(+), 23 deletions(-) diff --git a/static/koboldai.js b/static/koboldai.js index 8669a263..0eebef23 100644 --- a/static/koboldai.js +++ b/static/koboldai.js @@ -1584,7 +1584,9 @@ function Change_Theme(theme) { //console.log(theme); var css = document.getElementById("CSSTheme"); css.setAttribute("href", "/themes/"+theme+".css"); - create_theming_elements(); + setTimeout(() => { + create_theming_elements(); + }, "1000") } function palette_color(item) { @@ -1598,8 +1600,6 @@ function getAllCSSVariableNames(styleSheets = document.styleSheets){ // loop each stylesheet //console.log(styleSheets); for(var i = 0; i < styleSheets.length; i++){ - //console.log(styleSheets[i]); - //console.log(styleSheets[i].ownerNode.attributes.id); // loop stylesheet's cssRules try{ // try/catch used because 'hasOwnProperty' doesn't work for( var j = 0; j < styleSheets[i].cssRules.length; j++){ @@ -1629,7 +1629,7 @@ function create_theming_elements() { advanced_table = document.createElement("table"); theme_area = document.getElementById("Palette"); theme_area.append(palette_table); - //console.log(cssVars); + console.log(cssVars); //theme_area.append(advanced_table); for (css_item of cssVars) { if (css_item[0].includes("_palette")) { @@ -1637,6 +1637,9 @@ function create_theming_elements() { input = document.getElementById(css_item[0].replace("--", "")); input.setAttribute("title", css_item[0].replace("--", "").replace("_palette", "")); input.value = css_item[1]; + console.log("Set "+css_item[0].replace("--", "")+" to "+css_item[1]); + console.log(input); + } } else { tr = document.createElement("tr"); diff --git a/templates/settings flyout.html b/templates/settings flyout.html index a5c21314..3c1523b2 100644 --- a/templates/settings flyout.html +++ b/templates/settings flyout.html @@ -169,7 +169,7 @@ - @@ -227,7 +227,7 @@

expand_more Theme

- @@ -252,31 +252,31 @@ Primary - - - - + + + + Secondary - - - - + + + + Tertiary - - - - + + + + Error - - - - + + + + diff --git a/themes/Monochrome.css b/themes/Monochrome.css index 76c491ab..77430ae5 100644 --- a/themes/Monochrome.css +++ b/themes/Monochrome.css @@ -1,5 +1,6 @@ :root { -/*----------------Palette Theme--------------------*/--primary_palette: #afc6ff; +/*----------------Palette Theme--------------------*/ + --primary_palette: #afc6ff; --on_primary_palette: #002d6c; --primary_containter_palette: #004397; --on_primary_containter_palette: #d9e2ff;