Add contrast to the text/icon of buttons if the server defined color is light.
authorCamila <hello@camila.codes>
Tue, 14 Jun 2022 19:24:21 +0000 (21:24 +0200)
committerCamila <hello@camila.codes>
Tue, 21 Jun 2022 09:49:30 +0000 (11:49 +0200)
Signed-off-by: Camila <hello@camila.codes>
src/gui/tray/ActivityItem.qml
src/gui/tray/ActivityItemActions.qml
src/gui/tray/ActivityItemContent.qml
src/gui/tray/CustomButton.qml

index a22f1396492d9a643ee825fadc17abc1f6c8d92a..68a15351085aed0253380537e88e7703a0f301c4 100644 (file)
@@ -17,6 +17,9 @@ MouseArea {
     property bool isTalkReplyOptionVisible: model.messageSent !== ""
     readonly property bool isCallActivity: model.objectType === "call"
 
+    property color adjustedHeaderColor: Theme.darkMode ? Qt.lighter(UserModel.currentUser.headerColor, 2)
+                                                       : Qt.darker(UserModel.currentUser.headerColor, 1.5)
+
     signal fileActivityButtonClicked(string absolutePath)
 
     enabled: (model.path !== "" || model.link !== "" || model.isCurrentUserFileActivity === true)
@@ -74,6 +77,8 @@ MouseArea {
 
             activityData: model
 
+            adjustedHeaderColor: root.adjustedHeaderColor
+
             onShareButtonClicked: Systray.openShareDialog(model.displayPath, model.absolutePath)
             onDismissButtonClicked: activityModel.slotTriggerDismiss(model.index)
         }
@@ -113,6 +118,8 @@ MouseArea {
 
             flickable: root.flickable
 
+            adjustedHeaderColor: root.adjustedHeaderColor
+
             onTriggerAction: activityModel.slotTriggerAction(model.index, actionIndex)
             onShowReplyField: root.toggleReplyOptions()
         }
index f86ad70d796bc5aed12407ff23ff0b9848d6e2cc..4e1c7121a8c1c0c56cd3e0c0af2da318a6012abe 100644 (file)
@@ -16,6 +16,7 @@ RowLayout {
     property bool displayActions: false
 
     property color moreActionsButtonColor: "transparent"
+    property color adjustedHeaderColor: "transparent"
 
     property int maxActionButtons: 0
 
@@ -43,10 +44,10 @@ RowLayout {
             text: model.modelData.label
             toolTipText: model.modelData.label
 
-            imageSource: model.modelData.imageSource ? model.modelData.imageSource + UserModel.currentUser.headerColor : ""
+            imageSource: model.modelData.imageSource ? model.modelData.imageSource + root.adjustedHeaderColor : ""
             imageSourceHover: model.modelData.imageSourceHovered ? model.modelData.imageSourceHovered + UserModel.currentUser.headerTextColor : ""
 
-            textColor: imageSource !== "" ? UserModel.currentUser.headerColor : Style.ncTextColor
+            textColor: imageSource !== "" ? root.adjustedHeaderColor : Style.ncTextColor
             textColorHovered: imageSource !== "" ? UserModel.currentUser.headerTextColor : Style.ncTextColor
 
             bold: primary
index 77d07814ee37996a89a4398c616c7a6b99f05c1c..3e34acf979cc7ef9df252dc8bbc32fe8378904d2 100644 (file)
@@ -17,6 +17,8 @@ RowLayout {
 
     property bool childHovered: shareButton.hovered || dismissActionButton.hovered
 
+    property color adjustedHeaderColor: "transparent"
+
     signal dismissButtonClicked()
     signal shareButtonClicked()
 
@@ -221,7 +223,7 @@ RowLayout {
 
         visible: root.activityData.isShareable
 
-        imageSource: "image://svgimage-custom-color/share.svg" + "/" + UserModel.currentUser.headerColor
+        imageSource: "image://svgimage-custom-color/share.svg" + "/" + root.adjustedHeaderColor
         imageSourceHover: "image://svgimage-custom-color/share.svg" + "/" + UserModel.currentUser.headerTextColor
 
         toolTipText: qsTr("Open share dialog")
index 0ddb40d24b45cefbe3ed3d541f6a652d0a5b0356..32d6ff575ee49c32e7756dca950b59e78c0438cd 100644 (file)
@@ -15,14 +15,15 @@ Button {
     property color textColor: Style.ncTextColor
     property color textColorHovered: textColor
 
-    property color bgColor: "transparent"
+    property alias bgColor: bgRectangle.color
 
     property bool bold: false
 
     property real bgOpacity: 0.3
 
     background: Rectangle {
-        color: root.bgColor
+        id: bgRectangle
+        color: "transparent"
         opacity: parent.hovered ? 1.0 : bgOpacity
         radius: width / 2
     }