From d6b37d32d9eca736b20e6b2afd0f930f214ab973 Mon Sep 17 00:00:00 2001 From: DarkCat09 Date: Mon, 24 Jul 2023 20:32:26 +0400 Subject: [PATCH] Async LessCSS loading; changed colors --- src/components/ThemeModal.astro | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/components/ThemeModal.astro b/src/components/ThemeModal.astro index b1cfb56..89e7c66 100644 --- a/src/components/ThemeModal.astro +++ b/src/components/ThemeModal.astro @@ -27,10 +27,11 @@ import TextBox from "./TextBox.astro"; - - - - + + + + + @@ -52,6 +53,10 @@ import TextBox from "./TextBox.astro"; .color-btns { margin-top: 0.2rem; + + display: flex; + flex-direction: row; + column-gap: 0.25rem; } .hint { @@ -234,12 +239,21 @@ import TextBox from "./TextBox.astro"; lessStyles.type = 'text/css' lessStyles.href = '/theme_dyn.less' document.head.append(lessStyles) + // Create script element for Less config + const lessConfig = document.createElement('script') + lessConfig.innerText = 'less = ' + JSON.stringify({ + env: 'production', + async: true, // really important for slow internet connection + fileAsync: true, + errorReporting: 'console', + }) // Create LessCSS script element const lessScript = document.createElement('script') lessScript.src = '/less.min.js' // Modify variables when less is loaded lessScript.addEventListener('load', reloadTheme) // Load LessCSS script + document.head.append(lessConfig) document.head.append(lessScript) } else