Allow to customize font color

This commit is contained in:
hat3ph
2024-06-09 11:15:20 +08:00
committed by GitHub
parent 6b53193506
commit b56c52d06b
4 changed files with 28 additions and 20 deletions

View File

@@ -25,7 +25,7 @@ Rectangle {
} }
function onLoginFailed() { function onLoginFailed() {
error_message.color = "#dc322f" error_message.color = config.errorMsgFontColor
error_message.text = textConstants.loginFailed error_message.text = textConstants.loginFailed
} }
} }
@@ -207,7 +207,7 @@ Rectangle {
Column { Column {
id: clock id: clock
property date dateTime: new Date() property date dateTime: new Date()
property color color: "white" property color color: config.clockFontColor
y: parent.height * config.relativePositionY - clock.height / 2 y: parent.height * config.relativePositionY - clock.height / 2
x: parent.width * config.relativePositionX - clock.width / 2 x: parent.width * config.relativePositionX - clock.width / 2
@@ -263,7 +263,7 @@ Rectangle {
font.family: textFont.name font.family: textFont.name
font.bold: true font.bold: true
font.pixelSize: config.labelFontSize font.pixelSize: config.labelFontSize
color: "white" color: config.labelFontColor
text: "Username" text: "Username"
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
@@ -280,7 +280,7 @@ Rectangle {
font: textFont.name font: textFont.name
color: "#25000000" color: "#25000000"
borderColor: "transparent" borderColor: "transparent"
textColor: "white" textColor: config.labelFontColor
Keys.onPressed: { Keys.onPressed: {
if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) { if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) {
@@ -313,7 +313,7 @@ Rectangle {
font.family: textFont.name font.family: textFont.name
font.bold: true font.bold: true
font.pixelSize: config.labelFontSize font.pixelSize: config.labelFontSize
color: "white" color: config.labelFontColor
} }
PasswordBox { PasswordBox {
@@ -327,7 +327,7 @@ Rectangle {
anchors.left: password_label.right anchors.left: password_label.right
anchors.leftMargin: config.passwordLeftMargin anchors.leftMargin: config.passwordLeftMargin
borderColor: "transparent" borderColor: "transparent"
textColor: "white" textColor: config.labelFontColor
tooltipBG: "#25000000" tooltipBG: "#25000000"
tooltipFG: "#dc322f" tooltipFG: "#dc322f"
image: "components/resources/warning_red.png" image: "components/resources/warning_red.png"
@@ -357,6 +357,7 @@ Rectangle {
width: parent.height width: parent.height
color: "transparent" color: "transparent"
text: "x" text: "x"
textColor: config.labelFontColor
font: textFont.name font: textFont.name
border.color: "transparent" border.color: "transparent"
@@ -388,7 +389,7 @@ Rectangle {
disabledColor: "#dc322f" disabledColor: "#dc322f"
activeColor: "#268bd2" activeColor: "#268bd2"
pressedColor: "#2aa198" pressedColor: "#2aa198"
textColor: "white" textColor: config.labelFontColor
font: textFont.name font: textFont.name
onClicked: sddm.login(username_input_box.text, password_input_box.text, session.index) onClicked: sddm.login(username_input_box.text, password_input_box.text, session.index)
@@ -402,7 +403,7 @@ Rectangle {
height: parent.height height: parent.height
font.family: textFont.name font.family: textFont.name
font.pixelSize: config.errorMsgFontSize font.pixelSize: config.errorMsgFontSize
color: "white" //color: "white"
anchors.top: password_input_box.bottom anchors.top: password_input_box.bottom
anchors.left: password_input_box.left anchors.left: password_input_box.left
anchors.leftMargin: 0 anchors.leftMargin: 0
@@ -436,9 +437,11 @@ Rectangle {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
color: "transparent" color: "transparent"
arrowColor: "transparent" arrowColor: "transparent"
textColor: "#505050" textColor: config.actionBarFontColor
borderColor: "transparent" borderColor: "transparent"
hoverColor: "#5692c4" hoverColor: "#5692c4"
font.family: textFont.name
font.pixelSize: config.actionBarFontSize
model: sessionModel model: sessionModel
index: sessionModel.lastIndex index: sessionModel.lastIndex
@@ -457,7 +460,7 @@ Rectangle {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
color: "transparent" color: "transparent"
arrowColor: "transparent" arrowColor: "transparent"
textColor: "white" //textColor: "white"
borderColor: "transparent" borderColor: "transparent"
hoverColor: "#5692c4" hoverColor: "#5692c4"
@@ -483,8 +486,8 @@ Rectangle {
text: modelItem ? modelItem.modelData.shortName : "zz" text: modelItem ? modelItem.modelData.shortName : "zz"
font.family: textFont.name font.family: textFont.name
font.pixelSize: config.languageBoxFontSize font.pixelSize: config.actionBarFontSize
color: "#505050" color: config.actionBarFontColor
} }
} }
KeyNavigation.backtab: session KeyNavigation.backtab: session

View File

@@ -61,7 +61,8 @@ You can change a few settings in this file
- `bgImgDay` and `bgImgNight` - default background day/night image, now support GIF animated image - `bgImgDay` and `bgImgNight` - default background day/night image, now support GIF animated image
- `bgVidDay` and `bgImgNight` - video day/night playlists - `bgVidDay` and `bgImgNight` - video day/night playlists
- `displayFont` - font - `displayFont` - font
- `clockFontSize`, `dateFontSize`, `labelFontSize`, `errorMsgFontSize` and `languageBoxFontSize` - customize font size - `clockFontSize`, `dateFontSize`, `labelFontSize`, `errorMsgFontSize` and `actionBarFontSize` - customize font size
- `clockFontColor`, `labelFontColor` and `actionBarFontColor` - customize font color
- `dateFormat` and `timeFormat` - customize [date and time](https://doc.qt.io/qt-5/qml-qtqml-date.html) format - `dateFormat` and `timeFormat` - customize [date and time](https://doc.qt.io/qt-5/qml-qtqml-date.html) format
- `showLoginButton` - if set to false will hide the login button - `showLoginButton` - if set to false will hide the login button
- `showClearPasswordButton` - if set to false will hide the clear password button that appears when text is inputed - `showClearPasswordButton` - if set to false will hide the clear password button that appears when text is inputed
@@ -84,10 +85,11 @@ showTopBar=true
### Note that some configs names have changed from previous values: ### Note that some configs names have changed from previous values:
``` ```
day_time_start => dayTimeStart day_time_start => dayTimeStart
day_time_end => dayTimeEnd day_time_end => dayTimeEnd
background_vid_day => bgVidDay background_vid_day => bgVidDay
background_vid_night => bgVidNight background_vid_night => bgVidNight
languageBoxFontSize => actionBarFontSize
``` ```
## Preview ## Preview

View File

@@ -10,7 +10,7 @@ clockFontSize="72"
dateFontSize="24" dateFontSize="24"
labelFontSize="16" labelFontSize="16"
errorMsgFontSize="12" errorMsgFontSize="12"
languageBoxFontSize="14" actionBarFontSize="14"
timeFormat="hh:mm" timeFormat="hh:mm"
dateFormat="dddd, dd MMMM yyyy" dateFormat="dddd, dd MMMM yyyy"
showLoginButton=true showLoginButton=true
@@ -19,4 +19,8 @@ usernameLeftMargin=15
relativePositionX=0.3 relativePositionX=0.3
relativePositionY=0.7 relativePositionY=0.7
showTopBar=true showTopBar=true
autofocusInput=true autofocusInput=true
errorMsgFontColor="#dc322f"
clockFontColor="white"
labelFontColor="white"
actionBarFontColor="#505050"

View File

@@ -8,7 +8,6 @@ passwordLeftMargin=15
relativePositionX=0.5 relativePositionX=0.5
relativePositionY=0.75 relativePositionY=0.75
showLoginButton=false showLoginButton=false
type=color
usernameLeftMargin=15 usernameLeftMargin=15
showTopBar=true showTopBar=true
autofocusInput=true autofocusInput=true