summaryrefslogtreecommitdiff
path: root/src/caelestia/utils
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-06-11 21:42:13 +1000
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-06-11 21:42:13 +1000
commit6f7beecdc6de14cf1fd6be9038a86528d2ba52f0 (patch)
tree833a5c08ee8a858e98b0b99bc7685c447c8fe31c /src/caelestia/utils
parenttoggles: fix sysmon + not toggling ws (diff)
downloadcaelestia-cli-6f7beecdc6de14cf1fd6be9038a86528d2ba52f0.tar.gz
caelestia-cli-6f7beecdc6de14cf1fd6be9038a86528d2ba52f0.tar.bz2
caelestia-cli-6f7beecdc6de14cf1fd6be9038a86528d2ba52f0.zip
feat: theme discord
Diffstat (limited to 'src/caelestia/utils')
-rw-r--r--src/caelestia/utils/paths.py5
-rw-r--r--src/caelestia/utils/theme.py15
2 files changed, 17 insertions, 3 deletions
diff --git a/src/caelestia/utils/paths.py b/src/caelestia/utils/paths.py
index aff6ea0..dfb57d9 100644
--- a/src/caelestia/utils/paths.py
+++ b/src/caelestia/utils/paths.py
@@ -9,5 +9,8 @@ c_config_dir = config_dir / "caelestia"
c_data_dir = data_dir / "caelestia"
c_state_dir = state_dir / "caelestia"
+cli_data_dir = Path(__file__).parent.parent / "data"
+templates_dir = cli_data_dir / "templates"
+
scheme_path = c_state_dir / "scheme.json"
-scheme_data_path = Path(__file__).parent.parent / "data/schemes"
+scheme_data_path = cli_data_dir / "schemes"
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))