From 232f2992863d0866ede350d551226a86a425866f Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Wed, 30 Apr 2025 22:39:51 +1000 Subject: colours: adjust layer brightness when transparent Darken when light mode and lighten when dark mode for better visibility --- config/Appearance.qml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/config/Appearance.qml b/config/Appearance.qml index 99b0525..a80f010 100644 --- a/config/Appearance.qml +++ b/config/Appearance.qml @@ -9,6 +9,7 @@ Singleton { id: root property bool borders: true + property bool light: false readonly property Transparency transparency: Transparency {} readonly property Rounding rounding: Rounding {} readonly property Spacing spacing: Spacing {} @@ -20,7 +21,17 @@ Singleton { function alpha(c: color, layer: bool): color { if (!transparency.enabled) return c; - return Qt.rgba(c.r, c.g, c.b, layer ? transparency.layers : transparency.base); + c = Qt.rgba(c.r, c.g, c.b, layer ? transparency.layers : transparency.base); + if (layer) + c.hsvValue = Math.max(0, Math.min(1, c.hslLightness + (light ? -0.2 : 0.1))); + return c; + } + + FileView { + path: `${StandardPaths.standardLocations(StandardPaths.GenericStateLocation)[0]}/caelestia/scheme/current-mode.txt` + watchChanges: true + onFileChanged: this.reload() + onLoaded: root.light = this.text() === "light" } FileView { -- cgit v1.2.3-freya