Use color palette.

This commit is contained in:
Black Hat 2018-12-16 10:47:58 +08:00
parent df045a786f
commit 0d06498467
10 changed files with 34 additions and 13 deletions

View File

@ -1,7 +1,6 @@
import QtQuick 2.12 import QtQuick 2.12
import QtQuick.Controls 2.4 import QtQuick.Controls 2.4
import QtQuick.Layouts 1.3 import QtQuick.Layouts 1.3
import QtQuick.Controls.Material 2.4
import Spectral.Setting 0.1 import Spectral.Setting 0.1
import Spectral.Font 0.1 import Spectral.Font 0.1
@ -11,7 +10,7 @@ Text {
id: materialLabel id: materialLabel
color: Material.foreground color: MPalette.foreground
font.pixelSize: 24 font.pixelSize: 24
font.family: MaterialFont.name font.family: MaterialFont.name
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter

View File

@ -58,7 +58,7 @@ ColumnLayout {
visible: !(sentByMe || avatarVisible) visible: !(sentByMe || avatarVisible)
text: Qt.formatDateTime(time, "hh:mm") text: Qt.formatDateTime(time, "hh:mm")
color: "#5B7480" color: MPalette.lighter
font.pixelSize: 10 font.pixelSize: 10
horizontalAlignment: Label.AlignHCenter horizontalAlignment: Label.AlignHCenter

View File

@ -1,8 +1,10 @@
import QtQuick 2.12 import QtQuick 2.12
import QtQuick.Controls 2.4 import QtQuick.Controls 2.4
import Spectral.Setting 0.1
Label { Label {
text: section + " • " + Qt.formatTime(time, "hh:mm") text: section + " • " + Qt.formatTime(time, "hh:mm")
color: MPalette.foreground
font.pixelSize: 13 font.pixelSize: 13
font.weight: Font.Medium font.weight: Font.Medium
font.capitalization: Font.AllUppercase font.capitalization: Font.AllUppercase

View File

@ -6,6 +6,7 @@ import QtQuick.Controls.Material 2.4
import Spectral 0.1 import Spectral 0.1
import Spectral.Effect 2.0 import Spectral.Effect 2.0
import Spectral.Component 2.0 import Spectral.Component 2.0
import Spectral.Setting 0.1
Control { Control {
property alias avatar: headerImage.source property alias avatar: headerImage.source
@ -53,6 +54,7 @@ Control {
Layout.fillHeight: true Layout.fillHeight: true
text: currentRoom ? currentRoom.displayName : "" text: currentRoom ? currentRoom.displayName : ""
color: MPalette.foreground
font.pixelSize: 16 font.pixelSize: 16
elide: Text.ElideRight elide: Text.ElideRight
wrapMode: Text.NoWrap wrapMode: Text.NoWrap
@ -64,7 +66,7 @@ Control {
id: headerTopicLabel id: headerTopicLabel
color: "#5B7480" color: MPalette.lighter
elide: Text.ElideRight elide: Text.ElideRight
wrapMode: Text.NoWrap wrapMode: Text.NoWrap
} }

View File

@ -12,7 +12,7 @@ import Spectral.Setting 0.1
import SortFilterProxyModel 0.2 import SortFilterProxyModel 0.2
Rectangle { Item {
property var controller: null property var controller: null
readonly property var user: controller.connection ? controller.connection.localUser : null readonly property var user: controller.connection ? controller.connection.localUser : null
@ -25,8 +25,6 @@ Rectangle {
id: root id: root
color: MSettings.darkTheme ? "#303030" : "#FFFFFF"
RoomListModel { RoomListModel {
id: roomListModel id: roomListModel
@ -638,6 +636,7 @@ Rectangle {
topPadding: 0 topPadding: 0
bottomPadding: 0 bottomPadding: 0
placeholderText: "Search..." placeholderText: "Search..."
color: MPalette.lighter
background: Item {} background: Item {}
} }
@ -779,6 +778,7 @@ Rectangle {
Layout.fillHeight: true Layout.fillHeight: true
text: name || "No Name" text: name || "No Name"
color: MPalette.foreground
font.pixelSize: 16 font.pixelSize: 16
elide: Text.ElideRight elide: Text.ElideRight
wrapMode: Text.NoWrap wrapMode: Text.NoWrap
@ -789,7 +789,7 @@ Rectangle {
Layout.fillHeight: true Layout.fillHeight: true
text: (lastEvent == "" ? topic : lastEvent).replace(/(\r\n\t|\n|\r\t)/gm,"") text: (lastEvent == "" ? topic : lastEvent).replace(/(\r\n\t|\n|\r\t)/gm,"")
color: "#5B7480" color: MPalette.lighter
font.pixelSize: 13 font.pixelSize: 13
elide: Text.ElideRight elide: Text.ElideRight
wrapMode: Text.NoWrap wrapMode: Text.NoWrap
@ -855,7 +855,7 @@ Rectangle {
height: 24 height: 24
text: section text: section
color: "#5B7480" color: MPalette.lighter
leftPadding: 16 leftPadding: 16
elide: Text.ElideRight elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
@ -894,7 +894,7 @@ Rectangle {
} }
Button { Button {
text: "Reject" text: "Cancel"
flat: true flat: true
onClicked: inviteDialog.close() onClicked: inviteDialog.close()

View File

@ -0,0 +1,13 @@
pragma Singleton
import QtQuick 2.12
import QtQuick.Controls.Material 2.3
QtObject {
readonly property int theme: MSettings.darkTheme ? Material.Dark : Material.Light
readonly property color primary: "#344955"
readonly property color accent: "#673AB7"
readonly property color foreground: MSettings.darkTheme ? "#FFFFFF" : "#1D333E"
readonly property color background: MSettings.darkTheme ? "#303030" : "#FFFFFF"
readonly property color lighter: MSettings.darkTheme ? "#FFFFFF" : "#5B7480"
}

View File

@ -1,3 +1,3 @@
module Spectral.Setting module Spectral.Setting
singleton MSettings 0.1 Setting.qml singleton MSettings 0.1 Setting.qml
singleton MPalette 0.1 Palette.qml

View File

@ -14,7 +14,8 @@ import Spectral 0.1
import Spectral.Setting 0.1 import Spectral.Setting 0.1
ApplicationWindow { ApplicationWindow {
Material.theme: MSettings.darkTheme ? Material.Dark : Material.Light Material.theme: MPalette.theme
Material.background: MPalette.background
width: 960 width: 960
height: 640 height: 640
@ -26,6 +27,10 @@ ApplicationWindow {
visible: true visible: true
title: qsTr("Spectral") title: qsTr("Spectral")
background: Rectangle {
color: MSettings.darkTheme ? "#303030" : "#FFFFFF"
}
Platform.SystemTrayIcon { Platform.SystemTrayIcon {
visible: MSettings.showTray visible: MSettings.showTray
iconSource: "qrc:/assets/img/icon.png" iconSource: "qrc:/assets/img/icon.png"

View File

@ -10,5 +10,4 @@ Theme=Light
Variant=Dense Variant=Dense
Primary=#344955 Primary=#344955
Accent=#673AB7 Accent=#673AB7
Background=#FFFFFF
Font/Family="Roboto,Noto Sans,Noto Color Emoji" Font/Family="Roboto,Noto Sans,Noto Color Emoji"

View File

@ -42,5 +42,6 @@
<file>assets/img/roompanel-dark.svg</file> <file>assets/img/roompanel-dark.svg</file>
<file>imports/Spectral/Component/Timeline/ImageDelegate.qml</file> <file>imports/Spectral/Component/Timeline/ImageDelegate.qml</file>
<file>imports/Spectral/Component/Avatar.qml</file> <file>imports/Spectral/Component/Avatar.qml</file>
<file>imports/Spectral/Setting/Palette.qml</file>
</qresource> </qresource>
</RCC> </RCC>