From 6f7beecdc6de14cf1fd6be9038a86528d2ba52f0 Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Wed, 11 Jun 2025 21:42:13 +1000 Subject: feat: theme discord --- src/caelestia/utils/theme.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/caelestia/utils/theme.py') diff --git a/src/caelestia/utils/theme.py b/src/caelestia/utils/theme.py index 7774472..7940547 100644 --- a/src/caelestia/utils/theme.py +++ b/src/caelestia/utils/theme.py @@ -1,8 +1,9 @@ import json import subprocess +import tempfile from pathlib import Path -from caelestia.utils.paths import config_dir +from caelestia.utils.paths import config_dir, templates_dir def gen_conf(colours: dict[str, str]) -> str: @@ -15,7 +16,7 @@ def gen_conf(colours: dict[str, str]) -> str: def gen_scss(colours: dict[str, str]) -> str: scss = "" for name, colour in colours.items(): - scss += f"${name}: {colour};\n" + scss += f"${name}: #{colour};\n" return scss @@ -81,6 +82,16 @@ def apply_hypr(conf: str) -> None: try_write(config_dir / "hypr/scheme/current.conf", conf) +def apply_discord(scss: str) -> None: + with tempfile.TemporaryDirectory("w") as tmp_dir: + (Path(tmp_dir) / "_colours.scss").write_text(scss) + conf = subprocess.check_output(["sass", "-I", tmp_dir, templates_dir / "discord.scss"], text=True) + + for client in "Equicord", "Vencord", "BetterDiscord", "equicord", "vesktop", "legcord": + try_write(config_dir / client / "themes/caelestia.theme.css", conf) + + def apply_colours(colours: dict[str, str]) -> None: apply_terms(gen_sequences(colours)) apply_hypr(gen_conf(colours)) + apply_discord(gen_scss(colours)) -- cgit v1.2.3-freya