Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add contrast to the text/icon of buttons if the server defined color is light. #4641

Merged
merged 1 commit into from
Jun 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/gui/tray/ActivityItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -74,6 +77,8 @@ MouseArea {

activityData: model

adjustedHeaderColor: root.adjustedHeaderColor

onShareButtonClicked: Systray.openShareDialog(model.displayPath, model.absolutePath)
onDismissButtonClicked: activityModel.slotTriggerDismiss(model.index)
}
Expand Down Expand Up @@ -113,6 +118,8 @@ MouseArea {

flickable: root.flickable

adjustedHeaderColor: root.adjustedHeaderColor

onTriggerAction: activityModel.slotTriggerAction(model.index, actionIndex)
onShowReplyField: root.toggleReplyOptions()
}
Expand Down
5 changes: 3 additions & 2 deletions src/gui/tray/ActivityItemActions.qml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ RowLayout {
property bool displayActions: false

property color moreActionsButtonColor: "transparent"
property color adjustedHeaderColor: "transparent"

property int maxActionButtons: 0

Expand Down Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion src/gui/tray/ActivityItemContent.qml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ RowLayout {

property bool childHovered: shareButton.hovered || dismissActionButton.hovered

property color adjustedHeaderColor: "transparent"

signal dismissButtonClicked()
signal shareButtonClicked()

Expand Down Expand Up @@ -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")
Expand Down
5 changes: 3 additions & 2 deletions src/gui/tray/CustomButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down