diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-04-30 22:39:51 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-04-30 22:39:51 +1000 |
| commit | 232f2992863d0866ede350d551226a86a425866f (patch) | |
| tree | cd9dcc44a6fc4c2658df1ca8d1d9a681961acd3a | |
| parent | config: fix errors (diff) | |
| download | caelestia-shell-232f2992863d0866ede350d551226a86a425866f.tar.gz caelestia-shell-232f2992863d0866ede350d551226a86a425866f.tar.bz2 caelestia-shell-232f2992863d0866ede350d551226a86a425866f.zip | |
colours: adjust layer brightness when transparent
Darken when light mode and lighten when dark mode for better visibility
| -rw-r--r-- | config/Appearance.qml | 13 |
1 files changed, 12 insertions, 1 deletions
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 { |