From d727836cc9effb716fc3de89d06123e05feb823b Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Fri, 15 Aug 2025 15:53:39 +1000 Subject: theme: better qt theming Switch to Darkly for default QT style Use qt5ct-kde and qt6ct-kde --- src/caelestia/utils/material/generator.py | 16 ++++++++++++++++ src/caelestia/utils/theme.py | 19 ++++++++++++++++--- 2 files changed, 32 insertions(+), 3 deletions(-) (limited to 'src/caelestia/utils') diff --git a/src/caelestia/utils/material/generator.py b/src/caelestia/utils/material/generator.py index d304d7a..200fa7f 100644 --- a/src/caelestia/utils/material/generator.py +++ b/src/caelestia/utils/material/generator.py @@ -92,6 +92,14 @@ dark_catppuccin = [ hex_to_hct("b4befe"), ] +kcolours = [ + {"name": "klink", "hct": hex_to_hct("2980b9")}, + {"name": "kvisited", "hct": hex_to_hct("9b59b6")}, + {"name": "knegative", "hct": hex_to_hct("da4453")}, + {"name": "kneutral", "hct": hex_to_hct("f67400")}, + {"name": "kpositive", "hct": hex_to_hct("27ae60")}, +] + colour_names = [ "rosewater", "flamingo", @@ -185,6 +193,14 @@ def gen_scheme(scheme, primary: Hct) -> dict[str, str]: else: colours[colour_names[i]] = harmonize(hct, colours["primary_paletteKeyColor"], (-0.2 if light else 0.05)) + # KColours + for colour in kcolours: + colours[colour["name"]] = harmonize(colour["hct"], colours["primary"], 0.1) + colours[f"{colour['name']}Selection"] = harmonize(colour["hct"], colours["onPrimaryFixedVariant"], 0.1) + if scheme.variant == "monochrome": + colours[colour["name"]] = grayscale(colours[colour["name"]], light) + colours[f"{colour['name']}Selection"] = grayscale(colours[f"{colour['name']}Selection"], light) + if scheme.variant == "neutral": for name, hct in colours.items(): colours[name].chroma -= 15 diff --git a/src/caelestia/utils/theme.py b/src/caelestia/utils/theme.py index ead3e29..b3261d8 100644 --- a/src/caelestia/utils/theme.py +++ b/src/caelestia/utils/theme.py @@ -159,15 +159,28 @@ def apply_gtk(colours: dict[str, str], mode: str) -> None: def apply_qt(colours: dict[str, str], mode: str) -> None: - template = gen_replace(colours, templates_dir / "qtcolors.conf", hash=True) - write_file(config_dir / "qt5ct/colors/caelestia.conf", template) - write_file(config_dir / "qt6ct/colors/caelestia.conf", template) + template = gen_replace(colours, templates_dir / f"qt{mode}.colors", hash=True) + write_file(config_dir / "qt5ct/colors/caelestia.colors", template) + write_file(config_dir / "qt6ct/colors/caelestia.colors", template) qtct = (templates_dir / "qtct.conf").read_text() qtct = qtct.replace("{{ $mode }}", mode.capitalize()) for ver in 5, 6: conf = qtct.replace("{{ $config }}", str(config_dir / f"qt{ver}ct")) + + if ver == 5: + conf += """ +[Fonts] +fixed="Monospace,12,-1,5,50,0,0,0,0,0" +general="Sans Serif,12,-1,5,50,0,0,0,0,0" +""" + else: + conf += """ +[Fonts] +fixed="Monospace,12,-1,5,400,0,0,0,0,0,0,0,0,0,0,1" +general="Sans Serif,12,-1,5,400,0,0,0,0,0,0,0,0,0,0,1" +""" write_file(config_dir / f"qt{ver}ct/qt{ver}ct.conf", conf) -- cgit v1.2.3-freya