From a8bd8dddbfcb0c4837e44618ed4443d644196b3d Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Fri, 15 Apr 2022 05:53:41 +0200 Subject: [PATCH] Fix button colors --- qml/CommunitiesList.qml | 2 +- qml/Completer.qml | 6 +++--- qml/EncryptionIndicator.qml | 2 +- qml/ImageButton.qml | 2 +- qml/MessageInput.qml | 2 +- qml/MessageView.qml | 10 +++++----- qml/RoomList.qml | 6 +++--- qml/Root.qml | 22 +--------------------- qml/TimelineRow.qml | 2 +- qml/UploadBox.qml | 2 +- qml/components/AvatarListTile.qml | 2 +- qml/components/TextButton.qml | 2 +- qml/delegates/ImageMessage.qml | 2 +- qml/delegates/NoticeMessage.qml | 2 +- qml/dialogs/CreateDirect.qml | 2 +- qml/dialogs/ImagePackEditorDialog.qml | 2 +- qml/dialogs/ImagePackSettingsDialog.qml | 2 +- qml/dialogs/InviteDialog.qml | 2 +- qml/dialogs/ReadReceipts.qml | 2 +- qml/dialogs/RoomDirectory.qml | 2 +- qml/dialogs/RoomMembers.qml | 2 +- qml/emoji/EmojiPicker.qml | 8 ++++---- qml/emoji/StickerPicker.qml | 6 +++--- qml/pages/UserSettingsPage.qml | 2 +- qml/ui/NhekoSlider.qml | 2 +- src/MainWindow.cpp | 2 ++ src/ui/Theme.cpp | 4 ++++ 27 files changed, 44 insertions(+), 58 deletions(-) diff --git a/qml/CommunitiesList.qml b/qml/CommunitiesList.qml index 3f8163c9..ea4c8006 100644 --- a/qml/CommunitiesList.qml +++ b/qml/CommunitiesList.qml @@ -48,7 +48,7 @@ Page { property color backgroundColor: timelineRoot.palette.window property color importantText: timelineRoot.palette.text - property color unimportantText: timelineRoot.palette.buttonText + property color unimportantText: timelineRoot.palette.placeholderText property color bubbleBackground: timelineRoot.palette.highlight property color bubbleText: timelineRoot.palette.highlightedText diff --git a/qml/Completer.qml b/qml/Completer.qml index a45c184c..c8fc62bf 100644 --- a/qml/Completer.qml +++ b/qml/Completer.qml @@ -167,7 +167,7 @@ Control { Label { text: "(" + model.userid + ")" - color: model.index == popup.currentIndex ? timelineRoot.palette.highlightedText : timelineRoot.palette.buttonText + color: model.index == popup.currentIndex ? timelineRoot.palette.highlightedText : timelineRoot.palette.placeholderText } } @@ -224,7 +224,7 @@ Control { Label { text: "(" + model.packname + ")" - color: model.index == popup.currentIndex ? timelineRoot.palette.highlightedText : timelineRoot.palette.buttonText + color: model.index == popup.currentIndex ? timelineRoot.palette.highlightedText : timelineRoot.palette.placeholderText } } @@ -289,7 +289,7 @@ Control { Label { text: "(" + model.roomAlias + ")" - color: model.index == popup.currentIndex ? timelineRoot.palette.highlightedText : timelineRoot.palette.buttonText + color: model.index == popup.currentIndex ? timelineRoot.palette.highlightedText : timelineRoot.palette.placeholderText textFormat: Text.RichText } diff --git a/qml/EncryptionIndicator.qml b/qml/EncryptionIndicator.qml index c97b20f1..ca030182 100644 --- a/qml/EncryptionIndicator.qml +++ b/qml/EncryptionIndicator.qml @@ -40,7 +40,7 @@ Image { case Crypto.Verified: return sourceUrl + "green"; case Crypto.TOFU: - return sourceUrl + timelineRoot.palette.buttonText; + return sourceUrl + timelineRoot.palette.placeholderText; default: return sourceUrl + Nheko.theme.error; } diff --git a/qml/ImageButton.qml b/qml/ImageButton.qml index ff94d8b0..e4d0bbe6 100644 --- a/qml/ImageButton.qml +++ b/qml/ImageButton.qml @@ -14,7 +14,7 @@ AbstractButton { property alias cursor: mouseArea.cursorShape property string image: undefined property color highlightColor: timelineRoot.palette.highlight - property color buttonTextColor: timelineRoot.palette.buttonText + property color buttonTextColor: timelineRoot.palette.placeholderText property bool changeColorOnHover: true property bool ripple: true diff --git a/qml/MessageInput.qml b/qml/MessageInput.qml index d15185f2..2dcdf407 100644 --- a/qml/MessageInput.qml +++ b/qml/MessageInput.qml @@ -137,7 +137,7 @@ Rectangle { selectByMouse: true placeholderText: qsTr("Write a message...") - placeholderTextColor: timelineRoot.palette.buttonText + placeholderTextColor: timelineRoot.palette.placeholderText color: timelineRoot.palette.text width: textInput.width verticalAlignment: TextEdit.AlignVCenter diff --git a/qml/MessageView.qml b/qml/MessageView.qml index 1b058d7b..4108cd44 100644 --- a/qml/MessageView.qml +++ b/qml/MessageView.qml @@ -73,7 +73,7 @@ Item { background: Rectangle { color: timelineRoot.palette.window - border.color: timelineRoot.palette.buttonText + border.color: timelineRoot.palette.placeholderText border.width: 1 radius: padding } @@ -108,7 +108,7 @@ Item { id: editButton visible: !!row.model && row.model.isEditable - buttonTextColor: timelineRoot.palette.buttonText + buttonTextColor: timelineRoot.palette.placeholderText width: 16 hoverEnabled: true image: ":/icons/icons/ui/edit.svg" @@ -335,7 +335,7 @@ Item { Label { id: statusMsg - color: timelineRoot.palette.buttonText + color: timelineRoot.palette.placeholderText text: Presence.userStatus(userId) textFormat: Text.PlainText elide: Text.ElideRight @@ -768,7 +768,7 @@ Item { background: Rectangle { color: toEndButton.down ? timelineRoot.palette.highlight : timelineRoot.palette.button opacity: enabled ? 1 : 0.3 - border.color: toEndButton.hovered ? timelineRoot.palette.highlight : timelineRoot.palette.buttonText + border.color: toEndButton.hovered ? timelineRoot.palette.highlight : timelineRoot.palette.placeholderText border.width: 1 radius: toEndButton.radius } @@ -789,7 +789,7 @@ Item { id: buttonImg anchors.fill: parent anchors.margins: Nheko.paddingMedium - source: "image://colorimage/:/icons/icons/ui/download.svg?" + (toEndButton.down ? timelineRoot.palette.highlightedText : timelineRoot.palette.buttonText) + source: "image://colorimage/:/icons/icons/ui/download.svg?" + (toEndButton.down ? timelineRoot.palette.highlightedText : timelineRoot.palette.placeholderText) fillMode: Image.PreserveAspectFit } diff --git a/qml/RoomList.qml b/qml/RoomList.qml index 3474d70d..1bdcd7e6 100644 --- a/qml/RoomList.qml +++ b/qml/RoomList.qml @@ -129,7 +129,7 @@ Page { property color backgroundColor: timelineRoot.palette.window property color importantText: timelineRoot.palette.text - property color unimportantText: timelineRoot.palette.buttonText + property color unimportantText: timelineRoot.palette.placeholderText property color bubbleBackground: timelineRoot.palette.highlight property color bubbleText: timelineRoot.palette.highlightedText required property string roomName @@ -492,7 +492,7 @@ Page { ElidedLabel { Layout.alignment: Qt.AlignTop - color: timelineRoot.palette.buttonText + color: timelineRoot.palette.placeholderText font.pointSize: fontMetrics.font.pointSize * 0.9 elideWidth: col.width fullText: userInfoGrid.profile ? userInfoGrid.profile.userid : "" @@ -547,7 +547,7 @@ Page { Layout.margins: Nheko.paddingMedium Layout.rightMargin: Nheko.paddingSmall - color: timelineRoot.palette.buttonText + color: timelineRoot.palette.placeholderText Layout.fillWidth: true text: { switch (SelfVerificationStatus.status) { diff --git a/qml/Root.qml b/qml/Root.qml index 634b09ea..8edca57b 100644 --- a/qml/Root.qml +++ b/qml/Root.qml @@ -19,27 +19,7 @@ import im.nheko Pane { id: timelineRoot - - palette { - windowText: "#caccd1" - button: "white" - light: "#caccd1" - dark: "#3c464d" - mid: "#202228" - text: "#caccd1" - brightText: "#f4f5f8" - base: "#202228" - window: "#2d3139" - - alternateBase: "#2d3139" - highlight: "#38a3d8" - highlightedText: "#f4f5f8" - toolTipBase: timelineRoot.palette.base - toolTipText: timelineRoot.palette.text - link: "#38a3d8" - buttonText: "#828284" - - } + background: null padding: 0 diff --git a/qml/TimelineRow.qml b/qml/TimelineRow.qml index a8165b1d..88104c63 100644 --- a/qml/TimelineRow.qml +++ b/qml/TimelineRow.qml @@ -235,7 +235,7 @@ AbstractButton { width: parent.iconSize sourceSize.width: parent.iconSize * Screen.devicePixelRatio sourceSize.height: parent.iconSize * Screen.devicePixelRatio - source: "image://colorimage/:/icons/icons/ui/edit.svg?" + ((eventId == chat.model.edit) ? timelineRoot.palette.highlight : timelineRoot.palette.buttonText) + source: "image://colorimage/:/icons/icons/ui/edit.svg?" + ((eventId == chat.model.edit) ? timelineRoot.palette.highlight : timelineRoot.palette.placeholderText) ToolTip.visible: editHovered.hovered ToolTip.delay: Nheko.tooltipDelay ToolTip.text: qsTr("Edited") diff --git a/qml/UploadBox.qml b/qml/UploadBox.qml index 433d750a..a9e40a51 100644 --- a/qml/UploadBox.qml +++ b/qml/UploadBox.qml @@ -60,7 +60,7 @@ Page { case MediaUpload.Image: return "image"; default: return "zip"; } - source: (modelData.thumbnail != "") ? modelData.thumbnail : ("image://colorimage/:/icons/icons/ui/"+typeStr+".svg?" + timelineRoot.palette.buttonText) + source: (modelData.thumbnail != "") ? modelData.thumbnail : ("image://colorimage/:/icons/icons/ui/"+typeStr+".svg?" + timelineRoot.palette.placeholderText) } MatrixTextField { Layout.fillWidth: true diff --git a/qml/components/AvatarListTile.qml b/qml/components/AvatarListTile.qml index 10652fe1..a6573739 100644 --- a/qml/components/AvatarListTile.qml +++ b/qml/components/AvatarListTile.qml @@ -14,7 +14,7 @@ Rectangle { property color background: timelineRoot.palette.window property color importantText: timelineRoot.palette.text - property color unimportantText: timelineRoot.palette.buttonText + property color unimportantText: timelineRoot.palette.placeholderText property color bubbleBackground: timelineRoot.palette.highlight property color bubbleText: timelineRoot.palette.highlightedText property int avatarSize: Math.ceil(fontMetrics.lineSpacing * 2.3) diff --git a/qml/components/TextButton.qml b/qml/components/TextButton.qml index bd83c668..99d8ebee 100644 --- a/qml/components/TextButton.qml +++ b/qml/components/TextButton.qml @@ -13,7 +13,7 @@ AbstractButton { property alias cursor: mouseArea.cursorShape property color highlightColor: timelineRoot.palette.highlight - property color buttonTextColor: timelineRoot.palette.buttonText + property color buttonTextColor: timelineRoot.palette.placeholderText focusPolicy: Qt.NoFocus width: buttonText.implicitWidth diff --git a/qml/delegates/ImageMessage.qml b/qml/delegates/ImageMessage.qml index 67131684..d474a419 100644 --- a/qml/delegates/ImageMessage.qml +++ b/qml/delegates/ImageMessage.qml @@ -35,7 +35,7 @@ AbstractButton { anchors.fill: parent visible: img.status != Image.Ready - source: blurhash ? ("image://blurhash/" + blurhash) : ("image://colorimage/:/icons/icons/ui/image-failed.svg?" + timelineRoot.palette.buttonText) + source: blurhash ? ("image://blurhash/" + blurhash) : ("image://colorimage/:/icons/icons/ui/image-failed.svg?" + timelineRoot.palette.placeholderText) asynchronous: true fillMode: Image.PreserveAspectFit sourceSize.width: parent.width * Screen.devicePixelRatio diff --git a/qml/delegates/NoticeMessage.qml b/qml/delegates/NoticeMessage.qml index 3aa95185..2533fa88 100644 --- a/qml/delegates/NoticeMessage.qml +++ b/qml/delegates/NoticeMessage.qml @@ -10,7 +10,7 @@ import im.nheko TextMessage { property bool isStateEvent font.italic: true - color: timelineRoot.palette.buttonText + color: timelineRoot.palette.placeholderText font.pointSize: isStateEvent? 0.8*Settings.fontSize : Settings.fontSize horizontalAlignment: isStateEvent? Text.AlignHCenter : undefined } diff --git a/qml/dialogs/CreateDirect.qml b/qml/dialogs/CreateDirect.qml index f68011a9..825d8b0d 100644 --- a/qml/dialogs/CreateDirect.qml +++ b/qml/dialogs/CreateDirect.qml @@ -63,7 +63,7 @@ ApplicationWindow { Label { Layout.fillWidth: true text: userID.text - color: timelineRoot.palette.buttonText + color: timelineRoot.palette.placeholderText font.pointSize: fontMetrics.font.pointSize * 0.9 } } diff --git a/qml/dialogs/ImagePackEditorDialog.qml b/qml/dialogs/ImagePackEditorDialog.qml index cd270f9d..b5d926c7 100644 --- a/qml/dialogs/ImagePackEditorDialog.qml +++ b/qml/dialogs/ImagePackEditorDialog.qml @@ -98,7 +98,7 @@ ApplicationWindow { property color background: timelineRoot.palette.window property color importantText: timelineRoot.palette.text - property color unimportantText: timelineRoot.palette.buttonText + property color unimportantText: timelineRoot.palette.placeholderText property color bubbleBackground: timelineRoot.palette.highlight property color bubbleText: timelineRoot.palette.highlightedText required property string shortCode diff --git a/qml/dialogs/ImagePackSettingsDialog.qml b/qml/dialogs/ImagePackSettingsDialog.qml index b17e4b05..a0e1962d 100644 --- a/qml/dialogs/ImagePackSettingsDialog.qml +++ b/qml/dialogs/ImagePackSettingsDialog.qml @@ -94,7 +94,7 @@ ApplicationWindow { property color background: timelineRoot.palette.window property color importantText: timelineRoot.palette.text - property color unimportantText: timelineRoot.palette.buttonText + property color unimportantText: timelineRoot.palette.placeholderText property color bubbleBackground: timelineRoot.palette.highlight property color bubbleText: timelineRoot.palette.highlightedText required property string displayName diff --git a/qml/dialogs/InviteDialog.qml b/qml/dialogs/InviteDialog.qml index 5b161263..bc79dc3e 100644 --- a/qml/dialogs/InviteDialog.qml +++ b/qml/dialogs/InviteDialog.qml @@ -137,7 +137,7 @@ ApplicationWindow { Label { text: model.mxid - color: del.hovered ? timelineRoot.palette.brightText : timelineRoot.palette.buttonText + color: del.hovered ? timelineRoot.palette.brightText : timelineRoot.palette.placeholderText font.pointSize: fontMetrics.font.pointSize * 0.9 } diff --git a/qml/dialogs/ReadReceipts.qml b/qml/dialogs/ReadReceipts.qml index e3460dc7..7bb7d62f 100644 --- a/qml/dialogs/ReadReceipts.qml +++ b/qml/dialogs/ReadReceipts.qml @@ -98,7 +98,7 @@ ApplicationWindow { Label { text: model.timestamp - color: timelineRoot.palette.buttonText + color: timelineRoot.palette.placeholderText font.pointSize: fontMetrics.font.pointSize * 0.9 } diff --git a/qml/dialogs/RoomDirectory.qml b/qml/dialogs/RoomDirectory.qml index 4b7cb007..5b205fc9 100644 --- a/qml/dialogs/RoomDirectory.qml +++ b/qml/dialogs/RoomDirectory.qml @@ -42,7 +42,7 @@ ApplicationWindow { property color background: timelineRoot.palette.window property color importantText: timelineRoot.palette.text - property color unimportantText: timelineRoot.palette.buttonText + property color unimportantText: timelineRoot.palette.placeholderText property int avatarSize: fontMetrics.height * 3.2 color: background diff --git a/qml/dialogs/RoomMembers.qml b/qml/dialogs/RoomMembers.qml index a8137977..33379c67 100644 --- a/qml/dialogs/RoomMembers.qml +++ b/qml/dialogs/RoomMembers.qml @@ -152,7 +152,7 @@ ApplicationWindow { ElidedLabel { fullText: model.mxid - color: del.hovered ? timelineRoot.palette.brightText : timelineRoot.palette.buttonText + color: del.hovered ? timelineRoot.palette.brightText : timelineRoot.palette.placeholderText font.pixelSize: Math.ceil(fontMetrics.font.pixelSize * 0.9) elideWidth: del.width - Nheko.paddingMedium * 2 - avatar.width - encryptInd.width } diff --git a/qml/emoji/EmojiPicker.qml b/qml/emoji/EmojiPicker.qml index 13bb90f2..64ab4e29 100644 --- a/qml/emoji/EmojiPicker.qml +++ b/qml/emoji/EmojiPicker.qml @@ -63,7 +63,7 @@ Menu { Layout.preferredWidth: 7 * 52 + 20 - 6 palette: timelineRoot.palette background: null - placeholderTextColor: timelineRoot.palette.buttonText + placeholderTextColor: timelineRoot.palette.placeholderText color: timelineRoot.palette.text placeholderText: qsTr("Search") selectByMouse: true @@ -90,7 +90,7 @@ Menu { id: clearSearch visible: emojiSearch.text !== '' - icon.source: "image://colorimage/:/icons/icons/ui/round-remove-button.svg?" + (clearSearch.hovered ? timelineRoot.palette.highlight : timelineRoot.palette.buttonText) + icon.source: "image://colorimage/:/icons/icons/ui/round-remove-button.svg?" + (clearSearch.hovered ? timelineRoot.palette.highlight : timelineRoot.palette.placeholderText) focusPolicy: Qt.NoFocus onClicked: emojiSearch.clear() hoverEnabled: true @@ -105,7 +105,7 @@ Menu { Image { height: parent.height - 2 * Nheko.paddingSmall width: height - source: "image://colorimage/:/icons/icons/ui/round-remove-button.svg?" + (clearSearch.hovered ? timelineRoot.palette.highlight : timelineRoot.palette.buttonText) + source: "image://colorimage/:/icons/icons/ui/round-remove-button.svg?" + (clearSearch.hovered ? timelineRoot.palette.highlight : timelineRoot.palette.placeholderText) anchors { verticalCenter: parent.verticalCenter @@ -294,7 +294,7 @@ Menu { mipmap: true sourceSize.width: 32 * Screen.devicePixelRatio sourceSize.height: 32 * Screen.devicePixelRatio - source: "image://colorimage/" + modelData.image + "?" + (hovered ? timelineRoot.palette.highlight : timelineRoot.palette.buttonText) + source: "image://colorimage/" + modelData.image + "?" + (hovered ? timelineRoot.palette.highlight : timelineRoot.palette.placeholderText) } background: Rectangle { diff --git a/qml/emoji/StickerPicker.qml b/qml/emoji/StickerPicker.qml index f2332af5..f8f436e6 100644 --- a/qml/emoji/StickerPicker.qml +++ b/qml/emoji/StickerPicker.qml @@ -64,7 +64,7 @@ Menu { Layout.preferredWidth: stickersPerRow * stickerDimPad + 20 - 6 palette: timelineRoot.palette background: null - placeholderTextColor: timelineRoot.palette.buttonText + placeholderTextColor: timelineRoot.palette.placeholderText color: timelineRoot.palette.text placeholderText: qsTr("Search") selectByMouse: true @@ -88,7 +88,7 @@ Menu { id: clearSearch visible: emojiSearch.text !== '' - icon.source: "image://colorimage/:/icons/icons/ui/round-remove-button.svg?" + (clearSearch.hovered ? timelineRoot.palette.highlight : timelineRoot.palette.buttonText) + icon.source: "image://colorimage/:/icons/icons/ui/round-remove-button.svg?" + (clearSearch.hovered ? timelineRoot.palette.highlight : timelineRoot.palette.placeholderText) focusPolicy: Qt.NoFocus onClicked: emojiSearch.clear() hoverEnabled: true @@ -103,7 +103,7 @@ Menu { Image { height: parent.height - 2 * Nheko.paddingSmall width: height - source: "image://colorimage/:/icons/icons/ui/round-remove-button.svg?" + (clearSearch.hovered ? timelineRoot.palette.highlight : timelineRoot.palette.buttonText) + source: "image://colorimage/:/icons/icons/ui/round-remove-button.svg?" + (clearSearch.hovered ? timelineRoot.palette.highlight : timelineRoot.palette.placeholderText) anchors { verticalCenter: parent.verticalCenter diff --git a/qml/pages/UserSettingsPage.qml b/qml/pages/UserSettingsPage.qml index 5e74624c..3cf7d26e 100644 --- a/qml/pages/UserSettingsPage.qml +++ b/qml/pages/UserSettingsPage.qml @@ -178,7 +178,7 @@ Rectangle { anchors.top: parent.top anchors.left: parent.left anchors.right: parent.right - color: timelineRoot.palette.buttonText + color: timelineRoot.palette.placeholderText height: 1 } } diff --git a/qml/ui/NhekoSlider.qml b/qml/ui/NhekoSlider.qml index 4fa90304..285efadb 100644 --- a/qml/ui/NhekoSlider.qml +++ b/qml/ui/NhekoSlider.qml @@ -26,7 +26,7 @@ Slider { width: control.availableWidth - handle.width height: implicitHeight radius: height / 2 - color: timelineRoot.palette.buttonText + color: timelineRoot.palette.placeholderText Rectangle { width: control.visualPosition * parent.width diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 4d2799bf..e8b7a341 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -72,6 +72,8 @@ MainWindow::MainWindow(QWindow *parent) registerQmlTypes(); setColor(Theme::paletteFromTheme(userSettings_->theme()).window().color()); + QApplication::setPalette(Theme::paletteFromTheme(userSettings_->theme())); + setSource(QUrl(QStringLiteral("qrc:///im/nheko/qml/Root.qml"))); trayIcon_ = new TrayIcon(QStringLiteral(":/logos/nheko.svg"), this); diff --git a/src/ui/Theme.cpp b/src/ui/Theme.cpp index f3bd5b78..2f95b274 100644 --- a/src/ui/Theme.cpp +++ b/src/ui/Theme.cpp @@ -31,6 +31,8 @@ Theme::paletteFromTheme(QStringView theme) lightActive.setColor(QPalette::ToolTipText, lightActive.text().color()); lightActive.setColor(QPalette::Link, QColor(0x00, 0x77, 0xb5)); lightActive.setColor(QPalette::ButtonText, QColor(0x55, 0x54, 0x59)); + lightActive.setColor(QPalette::PlaceholderText, QColor(0x55, 0x54, 0x59)); + return lightActive; }(); return lightActive; @@ -53,6 +55,8 @@ Theme::paletteFromTheme(QStringView theme) darkActive.setColor(QPalette::ToolTipText, darkActive.text().color()); darkActive.setColor(QPalette::Link, QColor(0x38, 0xa3, 0xd8)); darkActive.setColor(QPalette::ButtonText, QColor(0x82, 0x82, 0x84)); + darkActive.setColor(QPalette::PlaceholderText, QColor(0x82, 0x82, 0x84)); + return darkActive; }(); return darkActive;