From 1a0816655d3eb857ed84951b52558a47724875c3 Mon Sep 17 00:00:00 2001
From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>
Date: Wed, 19 Feb 2025 15:04:57 +1100
Subject: scheme: use new scheme backend

---
 app.tsx | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

(limited to 'app.tsx')

diff --git a/app.tsx b/app.tsx
index f6ed759..113644e 100644
--- a/app.tsx
+++ b/app.tsx
@@ -11,12 +11,18 @@ import { execAsync, GLib, monitorFile, readFileAsync, writeFileAsync } from "ast
 import { App } from "astal/gtk3";
 
 const loadStyleAsync = async () => {
-    let scheme = "mocha";
+    let schemeColours;
     if (GLib.file_test(`${CACHE}/scheme/current.txt`, GLib.FileTest.EXISTS)) {
         const currentScheme = await readFileAsync(`${CACHE}/scheme/current.txt`);
-        if (GLib.file_test(`${SRC}/scss/scheme/_${currentScheme}.scss`, GLib.FileTest.EXISTS)) scheme = currentScheme;
-    }
-    await writeFileAsync(`${SRC}/scss/scheme/_index.scss`, `@forward "${scheme}";`);
+        schemeColours = currentScheme
+            .split("\n")
+            .map(l => {
+                const [name, hex] = l.split(" ");
+                return `$${name}: #${hex};`;
+            })
+            .join("\n");
+    } else schemeColours = await readFileAsync(`${SRC}/scss/scheme/_default.scss`);
+    await writeFileAsync(`${SRC}/scss/scheme/_index.scss`, schemeColours);
     App.apply_css(await execAsync(`sass ${SRC}/style.scss`), true);
 };
 
-- 
cgit v1.2.3-freya

