From b56c52d06b8665b5eaccde8136473126f184f3ea Mon Sep 17 00:00:00 2001 From: hat3ph <88069788+hat3ph@users.noreply.github.com> Date: Sun, 9 Jun 2024 11:15:20 +0800 Subject: [PATCH] Allow to customize font color --- Main.qml | 27 +++++++++++++++------------ README.md | 12 +++++++----- theme.conf | 8 ++++++-- theme.conf.user | 1 - 4 files changed, 28 insertions(+), 20 deletions(-) diff --git a/Main.qml b/Main.qml index f29cc4a..7354393 100644 --- a/Main.qml +++ b/Main.qml @@ -25,7 +25,7 @@ Rectangle { } function onLoginFailed() { - error_message.color = "#dc322f" + error_message.color = config.errorMsgFontColor error_message.text = textConstants.loginFailed } } @@ -207,7 +207,7 @@ Rectangle { Column { id: clock property date dateTime: new Date() - property color color: "white" + property color color: config.clockFontColor y: parent.height * config.relativePositionY - clock.height / 2 x: parent.width * config.relativePositionX - clock.width / 2 @@ -263,7 +263,7 @@ Rectangle { font.family: textFont.name font.bold: true font.pixelSize: config.labelFontSize - color: "white" + color: config.labelFontColor text: "Username" anchors.verticalCenter: parent.verticalCenter } @@ -280,7 +280,7 @@ Rectangle { font: textFont.name color: "#25000000" borderColor: "transparent" - textColor: "white" + textColor: config.labelFontColor Keys.onPressed: { if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) { @@ -313,7 +313,7 @@ Rectangle { font.family: textFont.name font.bold: true font.pixelSize: config.labelFontSize - color: "white" + color: config.labelFontColor } PasswordBox { @@ -327,7 +327,7 @@ Rectangle { anchors.left: password_label.right anchors.leftMargin: config.passwordLeftMargin borderColor: "transparent" - textColor: "white" + textColor: config.labelFontColor tooltipBG: "#25000000" tooltipFG: "#dc322f" image: "components/resources/warning_red.png" @@ -357,6 +357,7 @@ Rectangle { width: parent.height color: "transparent" text: "x" + textColor: config.labelFontColor font: textFont.name border.color: "transparent" @@ -388,7 +389,7 @@ Rectangle { disabledColor: "#dc322f" activeColor: "#268bd2" pressedColor: "#2aa198" - textColor: "white" + textColor: config.labelFontColor font: textFont.name onClicked: sddm.login(username_input_box.text, password_input_box.text, session.index) @@ -402,7 +403,7 @@ Rectangle { height: parent.height font.family: textFont.name font.pixelSize: config.errorMsgFontSize - color: "white" + //color: "white" anchors.top: password_input_box.bottom anchors.left: password_input_box.left anchors.leftMargin: 0 @@ -436,9 +437,11 @@ Rectangle { anchors.verticalCenter: parent.verticalCenter color: "transparent" arrowColor: "transparent" - textColor: "#505050" + textColor: config.actionBarFontColor borderColor: "transparent" hoverColor: "#5692c4" + font.family: textFont.name + font.pixelSize: config.actionBarFontSize model: sessionModel index: sessionModel.lastIndex @@ -457,7 +460,7 @@ Rectangle { anchors.verticalCenter: parent.verticalCenter color: "transparent" arrowColor: "transparent" - textColor: "white" + //textColor: "white" borderColor: "transparent" hoverColor: "#5692c4" @@ -483,8 +486,8 @@ Rectangle { text: modelItem ? modelItem.modelData.shortName : "zz" font.family: textFont.name - font.pixelSize: config.languageBoxFontSize - color: "#505050" + font.pixelSize: config.actionBarFontSize + color: config.actionBarFontColor } } KeyNavigation.backtab: session diff --git a/README.md b/README.md index 94ce4c1..62a5cfc 100644 --- a/README.md +++ b/README.md @@ -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 - `bgVidDay` and `bgImgNight` - video day/night playlists - `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 - `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 @@ -84,10 +85,11 @@ showTopBar=true ### Note that some configs names have changed from previous values: ``` -day_time_start => dayTimeStart -day_time_end => dayTimeEnd -background_vid_day => bgVidDay -background_vid_night => bgVidNight +day_time_start => dayTimeStart +day_time_end => dayTimeEnd +background_vid_day => bgVidDay +background_vid_night => bgVidNight +languageBoxFontSize => actionBarFontSize ``` ## Preview diff --git a/theme.conf b/theme.conf index b4f3cf4..9d3b251 100644 --- a/theme.conf +++ b/theme.conf @@ -10,7 +10,7 @@ clockFontSize="72" dateFontSize="24" labelFontSize="16" errorMsgFontSize="12" -languageBoxFontSize="14" +actionBarFontSize="14" timeFormat="hh:mm" dateFormat="dddd, dd MMMM yyyy" showLoginButton=true @@ -19,4 +19,8 @@ usernameLeftMargin=15 relativePositionX=0.3 relativePositionY=0.7 showTopBar=true -autofocusInput=true \ No newline at end of file +autofocusInput=true +errorMsgFontColor="#dc322f" +clockFontColor="white" +labelFontColor="white" +actionBarFontColor="#505050" \ No newline at end of file diff --git a/theme.conf.user b/theme.conf.user index d34633d..297c761 100644 --- a/theme.conf.user +++ b/theme.conf.user @@ -8,7 +8,6 @@ passwordLeftMargin=15 relativePositionX=0.5 relativePositionY=0.75 showLoginButton=false -type=color usernameLeftMargin=15 showTopBar=true autofocusInput=true \ No newline at end of file