Improve red button focus colour

- All of our red buttons were ImButton with the colours overridden at the
  use site.  Instead make an ImButtonRed which defines these colours in
  one place.
- Previously the red buttons had focus indicated by the text colour
  changing from white to blue.  This was quite hard to see, instead
  change the button colour to blue (as is done for the white buttons).
  A darker shade of blue is used so that there is still good contrast
  with the white text.
- Update the reds (buttons and main screen background) with the
  branding-approved red: the official colour palette says Pi Red is
  #cd2355
This commit is contained in:
David Turner 2023-10-18 16:38:06 +01:00 committed by David Turner
parent 98f8d63e3e
commit 8a3331f613
7 changed files with 27 additions and 30 deletions

View file

@ -94,47 +94,39 @@ Popup {
Layout.bottomMargin: 10 Layout.bottomMargin: 10
spacing: 20 spacing: 20
ImButton { ImButtonRed {
text: qsTr("NO") text: qsTr("NO")
onClicked: { onClicked: {
msgpopup.close() msgpopup.close()
msgpopup.no() msgpopup.no()
} }
visible: msgpopup.noButton visible: msgpopup.noButton
Material.foreground: activeFocus ? "#d1dcfb" : "#ffffff"
Material.background: "#c51a4a"
} }
ImButton { ImButtonRed {
text: qsTr("YES") text: qsTr("YES")
onClicked: { onClicked: {
msgpopup.close() msgpopup.close()
msgpopup.yes() msgpopup.yes()
} }
visible: msgpopup.yesButton visible: msgpopup.yesButton
Material.foreground: activeFocus ? "#d1dcfb" : "#ffffff"
Material.background: "#c51a4a"
} }
ImButton { ImButtonRed {
text: qsTr("CONTINUE") text: qsTr("CONTINUE")
onClicked: { onClicked: {
msgpopup.close() msgpopup.close()
} }
visible: msgpopup.continueButton visible: msgpopup.continueButton
Material.foreground: activeFocus ? "#d1dcfb" : "#ffffff"
Material.background: "#c51a4a"
} }
ImButton { ImButtonRed {
text: qsTr("QUIT") text: qsTr("QUIT")
onClicked: { onClicked: {
Qt.quit() Qt.quit()
} }
font.family: roboto.name font.family: roboto.name
visible: msgpopup.quitButton visible: msgpopup.quitButton
Material.foreground: activeFocus ? "#d1dcfb" : "#ffffff"
Material.background: "#c51a4a"
} }
Text { text: " " } Text { text: " " }

View file

@ -378,7 +378,7 @@ Window {
Layout.bottomMargin: 10 Layout.bottomMargin: 10
spacing: 20 spacing: 20
ImButton { ImButtonRed {
text: qsTr("SAVE") text: qsTr("SAVE")
onClicked: { onClicked: {
if (chkSetUser.checked && fieldUserPassword.text.length == 0) if (chkSetUser.checked && fieldUserPassword.text.length == 0)
@ -419,8 +419,6 @@ Window {
saveSettings() saveSettings()
popup.close() popup.close()
} }
Material.foreground: activeFocus ? "#d1dcfb" : "#ffffff"
Material.background: "#c51a4a"
} }
Text { text: " " } Text { text: " " }
@ -852,7 +850,7 @@ Window {
} else { } else {
fieldKeyboardLayout.currentIndex = fieldKeyboardLayout.find("us") fieldKeyboardLayout.currentIndex = fieldKeyboardLayout.find("us")
} }
chkSetUser.checked = false chkSetUser.checked = false
chkSSH.checked = false chkSSH.checked = false
chkLocale.checked = false chkLocale.checked = false

View file

@ -98,7 +98,7 @@ Popup {
spacing: 20 spacing: 20
id: buttons id: buttons
ImButton { ImButtonRed {
text: qsTr("EDIT SETTINGS") text: qsTr("EDIT SETTINGS")
onClicked: { onClicked: {
// Don't close this dialog when "edit settings" is // Don't close this dialog when "edit settings" is
@ -108,42 +108,34 @@ Popup {
// customisation or not. // customisation or not.
msgpopup.editSettings() msgpopup.editSettings()
} }
Material.foreground: activeFocus ? "#d1dcfb" : "#ffffff"
Material.background: "#c51a4a"
} }
ImButton { ImButtonRed {
id: noAndClearButton id: noAndClearButton
text: qsTr("NO, CLEAR SETTINGS") text: qsTr("NO, CLEAR SETTINGS")
onClicked: { onClicked: {
msgpopup.close() msgpopup.close()
msgpopup.noClearSettings() msgpopup.noClearSettings()
} }
Material.foreground: activeFocus ? "#d1dcfb" : "#ffffff"
Material.background: "#c51a4a"
enabled: hasSavedSettings enabled: hasSavedSettings
} }
ImButton { ImButtonRed {
id: yesButton id: yesButton
text: qsTr("YES") text: qsTr("YES")
onClicked: { onClicked: {
msgpopup.close() msgpopup.close()
msgpopup.yes() msgpopup.yes()
} }
Material.foreground: activeFocus ? "#d1dcfb" : "#ffffff"
Material.background: "#c51a4a"
enabled: hasSavedSettings enabled: hasSavedSettings
} }
ImButton { ImButtonRed {
text: qsTr("NO") text: qsTr("NO")
onClicked: { onClicked: {
msgpopup.close() msgpopup.close()
msgpopup.no() msgpopup.no()
} }
Material.foreground: activeFocus ? "#d1dcfb" : "#ffffff"
Material.background: "#c51a4a"
} }
Text { text: " " } Text { text: " " }

View file

@ -103,7 +103,7 @@ ApplicationWindow {
} }
Rectangle { Rectangle {
color: "#c31c4a" color: "#cd2355"
implicitWidth: window.width implicitWidth: window.width
implicitHeight: window.height * (1 - 1/4) implicitHeight: window.height * (1 - 1/4)

View file

@ -34,6 +34,7 @@
<file>icons/logo_stacked_imager.png</file> <file>icons/logo_stacked_imager.png</file>
<file>icons/logo_sxs_imager.png</file> <file>icons/logo_sxs_imager.png</file>
<file>qmlcomponents/ImButton.qml</file> <file>qmlcomponents/ImButton.qml</file>
<file>qmlcomponents/ImButtonRed.qml</file>
<file>qmlcomponents/ImCheckBox.qml</file> <file>qmlcomponents/ImCheckBox.qml</file>
<file>qmlcomponents/ImRadioButton.qml</file> <file>qmlcomponents/ImRadioButton.qml</file>
<file>icons/cat_digital_signage.png</file> <file>icons/cat_digital_signage.png</file>

View file

@ -11,7 +11,7 @@ import QtQuick.Controls.Material 2.2
Button { Button {
font.family: roboto.name font.family: roboto.name
Material.background: activeFocus ? "#d1dcfb" : "#ffffff" Material.background: activeFocus ? "#d1dcfb" : "#ffffff"
Material.foreground: "#c51a4a" Material.foreground: "#cd2355"
Accessible.onPressAction: clicked() Accessible.onPressAction: clicked()
Keys.onEnterPressed: clicked() Keys.onEnterPressed: clicked()
Keys.onReturnPressed: clicked() Keys.onReturnPressed: clicked()

View file

@ -0,0 +1,14 @@
/*
* SPDX-License-Identifier: Apache-2.0
* Copyright (C) 2022 Raspberry Pi Ltd
*/
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.0
import QtQuick.Controls.Material 2.2
ImButton {
Material.background: activeFocus ? "#32a0d7" : "#cd2355"
Material.foreground: "#ffffff"
}