cookie clock: put color props to root

This commit is contained in:
end-4
2025-09-23 11:13:18 +02:00
parent 769dafb428
commit 1f700f33b2
2 changed files with 17 additions and 10 deletions
@@ -3,6 +3,7 @@ pragma ComponentBehavior: Bound
import qs
import qs.services
import qs.modules.common
import qs.modules.common.models
import qs.modules.common.widgets
import qs.modules.common.functions as CF
import QtQuick
@@ -64,7 +65,7 @@ Variants {
}
// Colors
property bool shouldBlur: (GlobalStates.screenLocked && Config.options.lock.blur.enable)
property color dominantColor: Appearance.colors.colPrimary
property color dominantColor: Appearance.colors.colPrimary // Default, to be changed
property bool dominantColorIsDark: dominantColor.hslLightness < 0.5
property color colText: {
if (wallpaperSafetyTriggered)
@@ -20,11 +20,17 @@ Item {
property real minuteHandWidth: 8
property real centerDotSize: 10
property real hourDotSize: minuteHandWidth
property color colOnBackground: ColorUtils.mix(Appearance.colors.colPrimary, Appearance.colors.colSecondaryContainer, 0.5)
property list<string> clockNumbers: DateTime.time.split(/[: ]/)
property int clockHour: parseInt(clockNumbers[0]) % 12
property int clockMinute: parseInt(clockNumbers[1])
property color colShadow: Appearance.colors.colShadow
property color colBackground: Appearance.colors.colSecondaryContainer
property color colOnBackground: ColorUtils.mix(Appearance.colors.colPrimary, Appearance.colors.colSecondaryContainer, 0.5)
property color colHourHand: Appearance.colors.colPrimary
property color colMinuteHand: Appearance.colors.colSecondary
property color colOnHourHand: Appearance.colors.colOnPrimary
readonly property list<string> clockNumbers: DateTime.time.split(/[: ]/)
readonly property int clockHour: parseInt(clockNumbers[0]) % 12
readonly property int clockMinute: parseInt(clockNumbers[1])
implicitWidth: implicitSize
implicitHeight: implicitSize
@@ -35,7 +41,7 @@ Item {
verticalOffset: 2
radius: 12
samples: radius * 2 + 1
color: Appearance.colors.colShadow
color: root.colShadow
transparentBorder: true
}
@@ -45,7 +51,7 @@ Item {
implicitSize: root.implicitSize
amplitude: implicitSize / 70
sides: 12
color: Appearance.colors.colSecondaryContainer
color: root.colBackground
// 12 dots around the cookie
Repeater {
@@ -105,7 +111,7 @@ Item {
width: hourHandLength
height: hourHandWidth
radius: hourHandWidth / 2
color: Appearance.colors.colPrimary
color: root.colHourHand
}
}
@@ -120,14 +126,14 @@ Item {
width: minuteHandLength
height: minuteHandWidth
radius: minuteHandWidth / 2
color: Appearance.colors.colSecondary
color: root.colMinuteHand
}
}
// Center dot
Rectangle {
z: 4
color: Appearance.colors.colOnPrimary
color: root.colOnHourHand
anchors.centerIn: parent
implicitWidth: centerDotSize
implicitHeight: implicitWidth