From 84e839cf55fe745185c33b2d597501bcababa547 Mon Sep 17 00:00:00 2001 From: ATMDA Date: Wed, 12 Nov 2025 16:50:20 -0500 Subject: notif/toasts: refactoring colors --- services/Notifs.qml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'services') diff --git a/services/Notifs.qml b/services/Notifs.qml index ea0c52a..82ed8c4 100644 --- a/services/Notifs.qml +++ b/services/Notifs.qml @@ -179,6 +179,41 @@ Singleton { property bool hasActionIcons property list actions + readonly property bool isCritical: urgency === NotificationUrgency.Critical + readonly property bool isLow: urgency === NotificationUrgency.Low + + function getBackgroundColor(): color { + if (isCritical) return Colours.palette.m3secondaryContainer; + return Colours.tPalette.m3surfaceContainer; + } + + function getBadgeBackgroundColor(): color { + if (isCritical) return Colours.palette.m3error; + if (isLow) return Colours.layer(Colours.palette.m3surfaceContainerHighest, 2); + return Colours.palette.m3secondaryContainer; + } + + function getIconColor(): color { + if (isCritical) return Colours.palette.m3onError; + if (isLow) return Colours.palette.m3onSurface; + return Colours.palette.m3onSecondaryContainer; + } + + function getStateLayerColor(): color { + if (isCritical) return Colours.palette.m3onSecondaryContainer; + return Colours.palette.m3onSurface; + } + + function getActionBackgroundColor(): color { + if (isCritical) return Colours.palette.m3secondary; + return Colours.layer(Colours.palette.m3surfaceContainerHigh, 2); + } + + function getActionTextColor(): color { + if (isCritical) return Colours.palette.m3onSecondary; + return Colours.palette.m3onSurfaceVariant; + } + readonly property Timer timer: Timer { id: toastTimer -- cgit v1.2.3-freya