Small fix to buttons color

This commit is contained in:
Atlante45 2016-03-07 11:32:46 -08:00
parent 784f669998
commit 82d6d3ff01
2 changed files with 35 additions and 11 deletions

View file

@ -16,7 +16,10 @@ import "../styles-uit"
Original.Button { Original.Button {
id: button id: button
property int color: 0 property int color: 0
property int colorScheme: hifi.colorShemes.light
width: 120 width: 120
height: 28 height: 28
@ -24,27 +27,43 @@ Original.Button {
background: Rectangle { background: Rectangle {
radius: hifi.buttons.radius radius: hifi.buttons.radius
gradient: Gradient { gradient: Gradient {
GradientStop { GradientStop {
position: 0.2 position: 0.2
color: enabled color: {
? (!pressed && button.color != hifi.buttons.black || (!hovered || pressed) && button.color == hifi.buttons.black if (!enabled) {
? hifi.buttons.colorStart[button.color] : hifi.buttons.colorFinish[button.color]) hifi.buttons.disabledColorStart[button.colorScheme]
: hifi.buttons.colorStart[hifi.buttons.white] } else if (pressed) {
hifi.buttons.pressedColor[button.color]
} else if (hovered) {
hifi.buttons.hoveredColor[button.color]
} else {
hifi.buttons.colorStart[button.color]
}
}
} }
GradientStop { GradientStop {
position: 1.0 position: 1.0
color: enabled color: {
? ((!hovered || pressed) && button.color != hifi.buttons.black || !pressed && button.color == hifi.buttons.black if (!enabled) {
? hifi.buttons.colorFinish[button.color] : hifi.buttons.colorStart[button.color]) hifi.buttons.disabledColorFinish[button.colorScheme]
: hifi.buttons.colorFinish[hifi.buttons.white] } else if (pressed) {
hifi.buttons.pressedColor[button.color]
} else if (hovered) {
hifi.buttons.hoveredColor[button.color]
} else {
hifi.buttons.colorFinish[button.color]
}
}
} }
} }
} }
label: RalewayBold { label: RalewayBold {
font.capitalization: Font.AllUppercase font.capitalization: Font.AllUppercase
color: enabled ? hifi.buttons.textColor[button.color] : hifi.colors.lightGrayText color: enabled ? hifi.buttons.textColor[button.color]
: hifi.buttons.disabledTextColor[button.colorScheme]
size: hifi.fontSizes.buttonLabel size: hifi.fontSizes.buttonLabel
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter

View file

@ -159,8 +159,13 @@ Item {
readonly property int red: 2 readonly property int red: 2
readonly property int black: 3 readonly property int black: 3
readonly property var textColor: [ colors.darkGray, colors.white, colors.white, colors.white ] readonly property var textColor: [ colors.darkGray, colors.white, colors.white, colors.white ]
readonly property var colorStart: [ "#ffffff", "#00b4ef", "#d42043", "#343434" ] readonly property var colorStart: [ colors.white, colors.primaryHighlight, "#d42043", "#343434" ]
readonly property var colorFinish: [ "#afafaf", "#1080b8", "#94132e", "#000000" ] readonly property var colorFinish: [ colors.lightGrayText, colors.blueAccent, "#94132e", colors.black ]
readonly property var hoveredColor: [ colorStart[white], colorStart[blue], colorStart[red], colorFinish[black] ]
readonly property var pressedColor: [ colorFinish[white], colorFinish[blue], colorFinish[red], colorStart[black] ]
readonly property var disabledColorStart: [ colorStart[white], colors.baseGrayHighlight]
readonly property var disabledColorFinish: [ colorFinish[white], colors.baseGrayShadow]
readonly property var disabledTextColor: [ colors.lightGrayText, colors.baseGrayShadow]
readonly property int radius: 5 readonly property int radius: 5
} }