From fab2a81aee83ad3f2676ea07d858ddbc6053ad9c Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Sun, 15 Dec 2024 16:12:37 +0100 Subject: [PATCH] Ton down the intensity of the background on dark theme --- src/qml/RoomPage.qml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/qml/RoomPage.qml b/src/qml/RoomPage.qml index 11174947a..4cffd9ce7 100644 --- a/src/qml/RoomPage.qml +++ b/src/qml/RoomPage.qml @@ -171,6 +171,14 @@ Kirigami.Page { fillMode: Image.Tile horizontalAlignment: Image.AlignLeft verticalAlignment: Image.AlignTop + + function isDarkColor(background: color): bool { + const temp = Qt.darker(background, 1); + const darkness = 1 - (0.299 * temp.r + 0.587 * temp.g + 0.114 * temp.b); + return temp.a > 0 && darkness >= 0.4; + } + + opacity: isDarkColor(Kirigami.Theme.backgroundColor) ? 0.2 : 1 } }