mirror of
https://github.com/nextcloud/desktop.git
synced 2025-10-26 11:17:43 +00:00
fix: ensuring contrasting text color for highlighted menuitems
Signed-off-by: Tamás Bari <adaorcpp@gmail.com>
This commit is contained in:
parent
8145c1ef7a
commit
be3a001edc
@ -147,7 +147,7 @@ Button {
|
||||
color: !parent.enabled
|
||||
? parent.palette.mid
|
||||
: (parent.highlighted || parent.down
|
||||
? parent.palette.highlightedText
|
||||
? Style.contrastingColor( parent.palette.highlight )
|
||||
: parent.palette.text)
|
||||
}
|
||||
}
|
||||
@ -171,7 +171,7 @@ Button {
|
||||
color: !parent.enabled
|
||||
? parent.palette.mid
|
||||
: (parent.highlighted || parent.down
|
||||
? parent.palette.highlightedText
|
||||
? Style.contrastingColor( parent.palette.highlight )
|
||||
: parent.palette.text)
|
||||
}
|
||||
}
|
||||
@ -195,7 +195,7 @@ Button {
|
||||
color: !parent.enabled
|
||||
? parent.palette.mid
|
||||
: (parent.highlighted || parent.down
|
||||
? parent.palette.highlightedText
|
||||
? Style.contrastingColor( parent.palette.highlight )
|
||||
: parent.palette.text)
|
||||
}
|
||||
}
|
||||
|
||||
@ -83,7 +83,7 @@ AbstractButton {
|
||||
color: !userLine.parent.enabled
|
||||
? userLine.parent.palette.mid
|
||||
: (userLine.parent.highlighted || userLine.parent.down
|
||||
? userLine.parent.palette.highlightedText
|
||||
? Style.contrastingColor( parent.palette.highlight )
|
||||
: userLine.parent.palette.text)
|
||||
}
|
||||
|
||||
@ -103,7 +103,7 @@ AbstractButton {
|
||||
color: !userLine.parent.enabled
|
||||
? userLine.parent.palette.mid
|
||||
: (userLine.parent.highlighted || userLine.parent.down
|
||||
? userLine.parent.palette.highlightedText
|
||||
? Style.contrastingColor( parent.palette.highlight )
|
||||
: userLine.parent.palette.text)
|
||||
}
|
||||
|
||||
@ -135,7 +135,7 @@ AbstractButton {
|
||||
color: !userLine.parent.enabled
|
||||
? userLine.parent.palette.mid
|
||||
: (userLine.parent.highlighted || userLine.parent.down
|
||||
? userLine.parent.palette.highlightedText
|
||||
? Style.contrastingColor( parent.palette.highlight )
|
||||
: userLine.parent.palette.text)
|
||||
}
|
||||
}
|
||||
@ -159,7 +159,7 @@ AbstractButton {
|
||||
property var iconColor: !userLine.parent.enabled
|
||||
? userLine.parent.palette.mid
|
||||
: (!hovered && (userLine.parent.highlighted || userLine.parent.down)
|
||||
? userLine.parent.palette.highlightedText
|
||||
? Style.contrastingColor( parent.palette.highlight )
|
||||
: userLine.parent.palette.text)
|
||||
icon.source: "image://svgimage-custom-color/more.svg/" + iconColor
|
||||
|
||||
|
||||
@ -211,4 +211,10 @@ QtObject {
|
||||
function colorWithoutTransparency(color) {
|
||||
return Qt.rgba(color.r, color.g, color.b, 1)
|
||||
}
|
||||
|
||||
function contrastingColor(color) {
|
||||
// sRGB relative luminance formula
|
||||
const luminance = 0.299 * color.r + 0.587 * color.g + 0.114 * color.b
|
||||
return luminance > 0.5 ? Qt.darker( color, 2.0 ) : Qt.lighter( color, 2.0 )
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user