summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorATMDA <atdma2600@gmail.com>2025-11-12 16:50:20 -0500
committerATMDA <atdma2600@gmail.com>2025-11-12 16:50:20 -0500
commit84e839cf55fe745185c33b2d597501bcababa547 (patch)
treeae81b1a3d5b349762c8a0956595fccafac3e6735 /modules
parentnotifs/toasts: refactoring (diff)
downloadcaelestia-shell-84e839cf55fe745185c33b2d597501bcababa547.tar.gz
caelestia-shell-84e839cf55fe745185c33b2d597501bcababa547.tar.bz2
caelestia-shell-84e839cf55fe745185c33b2d597501bcababa547.zip
notif/toasts: refactoring colors
Diffstat (limited to 'modules')
-rw-r--r--modules/notifications/AppIconBadge.qml21
-rw-r--r--modules/notifications/Notification.qml26
-rw-r--r--modules/notifications/NotificationToast.qml2
3 files changed, 8 insertions, 41 deletions
diff --git a/modules/notifications/AppIconBadge.qml b/modules/notifications/AppIconBadge.qml
index 8bbae89..286522f 100644
--- a/modules/notifications/AppIconBadge.qml
+++ b/modules/notifications/AppIconBadge.qml
@@ -13,15 +13,9 @@ StyledRect {
required property Notifs.Notif modelData
required property bool hasImage
required property bool hasAppIcon
- required property bool isCritical
- required property bool isLow
radius: Appearance.rounding.full
- color: {
- if (root.isCritical) return Colours.palette.m3error;
- if (root.isLow) return Colours.layer(Colours.palette.m3surfaceContainerHighest, 2);
- return Colours.palette.m3secondaryContainer;
- }
+ color: modelData.getBadgeBackgroundColor()
implicitWidth: root.hasImage ? Config.notifs.sizes.badge : Config.notifs.sizes.image
implicitHeight: root.hasImage ? Config.notifs.sizes.badge : Config.notifs.sizes.image
@@ -40,11 +34,7 @@ StyledRect {
sourceComponent: ColouredIcon {
anchors.fill: parent
source: Quickshell.iconPath(root.modelData.appIcon)
- colour: {
- if (root.isCritical) return Colours.palette.m3onError;
- if (root.isLow) return Colours.palette.m3onSurface;
- return Colours.palette.m3onSecondaryContainer;
- }
+ colour: root.modelData.getIconColor()
layer.enabled: root.modelData.appIcon.endsWith("symbolic")
}
}
@@ -59,12 +49,7 @@ StyledRect {
sourceComponent: MaterialIcon {
text: Icons.getNotifIcon(root.modelData.summary, root.modelData.urgency)
-
- color: {
- if (root.isCritical) return Colours.palette.m3onError;
- if (root.isLow) return Colours.palette.m3onSurface;
- return Colours.palette.m3onSecondaryContainer;
- }
+ color: root.modelData.getIconColor()
font.pointSize: Appearance.font.size.large
}
}
diff --git a/modules/notifications/Notification.qml b/modules/notifications/Notification.qml
index 75defb6..bc5c086 100644
--- a/modules/notifications/Notification.qml
+++ b/modules/notifications/Notification.qml
@@ -17,8 +17,6 @@ StyledRect {
required property Notifs.Notif modelData
readonly property bool hasImage: modelData.image.length > 0
readonly property bool hasAppIcon: modelData.appIcon.length > 0
- readonly property bool isCritical: modelData.urgency === NotificationUrgency.Critical
- readonly property bool isLow: modelData.urgency === NotificationUrgency.Low
readonly property int nonAnimHeight: {
const baseHeight = summary.implicitHeight + inner.anchors.margins * 2;
return root.expanded
@@ -28,9 +26,7 @@ StyledRect {
property bool expanded
property bool disableSlideIn: false
- color: root.isCritical
- ? Colours.palette.m3secondaryContainer
- : Colours.tPalette.m3surfaceContainer
+ color: modelData.getBackgroundColor()
radius: Appearance.rounding.normal
implicitWidth: Config.notifs.sizes.width
implicitHeight: inner.implicitHeight
@@ -159,8 +155,6 @@ StyledRect {
modelData: root.modelData
hasImage: root.hasImage
hasAppIcon: root.hasAppIcon
- isCritical: root.isCritical
- isLow: root.isLow
}
}
@@ -302,9 +296,7 @@ StyledRect {
StateLayer {
radius: Appearance.rounding.full
- color: root.isCritical
- ? Colours.palette.m3onSecondaryContainer
- : Colours.palette.m3onSurface
+ color: root.modelData.getStateLayerColor()
function onClicked() {
root.expanded = !root.expanded;
@@ -424,12 +416,8 @@ StyledRect {
required property var modelData
- readonly property bool isCritical: root.isCritical
-
radius: Appearance.rounding.full
- color: isCritical
- ? Colours.palette.m3secondary
- : Colours.layer(Colours.palette.m3surfaceContainerHigh, 2)
+ color: root.modelData.getActionBackgroundColor()
Layout.preferredWidth: actionText.width + Appearance.padding.normal * 2
Layout.preferredHeight: actionText.height + Appearance.padding.small * 2
@@ -438,9 +426,7 @@ StyledRect {
StateLayer {
radius: Appearance.rounding.full
- color: isCritical
- ? Colours.palette.m3onSecondary
- : Colours.palette.m3onSurface
+ color: root.modelData.getStateLayerColor()
function onClicked(): void {
action.modelData.invoke();
@@ -452,9 +438,7 @@ StyledRect {
anchors.centerIn: parent
text: actionTextMetrics.elidedText
- color: isCritical
- ? Colours.palette.m3onSecondary
- : Colours.palette.m3onSurfaceVariant
+ color: root.modelData.getActionTextColor()
font.pointSize: Appearance.font.size.small
}
diff --git a/modules/notifications/NotificationToast.qml b/modules/notifications/NotificationToast.qml
index f8b830a..90414fe 100644
--- a/modules/notifications/NotificationToast.qml
+++ b/modules/notifications/NotificationToast.qml
@@ -85,8 +85,6 @@ StyledRect {
modelData: root.modelData
hasImage: root.hasImage
hasAppIcon: root.hasAppIcon
- isCritical: root.modelData.urgency === NotificationUrgency.Critical
- isLow: root.modelData.urgency === NotificationUrgency.Low
}
}
}