Skip to content

Commit e0225a0

Browse files
committed
qml: introduce Theme singleton
Holds color definitions and updates based on if in dark mode.
1 parent bbb3112 commit e0225a0

File tree

4 files changed

+33
-0
lines changed

4 files changed

+33
-0
lines changed

src/Makefile.qt.include

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,10 @@ QML_RES_QML = \
307307
qml/controls/OptionButton.qml \
308308
qml/controls/OptionSwitch.qml \
309309
qml/controls/ProgressIndicator.qml \
310+
qml/controls/qmldir \
310311
qml/controls/Setting.qml \
311312
qml/controls/TextButton.qml \
313+
qml/controls/Theme.qml \
312314
qml/pages/initerrormessage.qml \
313315
qml/pages/stub.qml
314316

src/qml/bitcoin_qml.qrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010
<file>controls/OptionButton.qml</file>
1111
<file>controls/OptionSwitch.qml</file>
1212
<file>controls/ProgressIndicator.qml</file>
13+
<file>controls/qmldir</file>
1314
<file>controls/Setting.qml</file>
1415
<file>controls/TextButton.qml</file>
16+
<file>controls/Theme.qml</file>
1517
<file>pages/initerrormessage.qml</file>
1618
<file>pages/stub.qml</file>
1719
</qresource>

src/qml/controls/Theme.qml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
pragma Singleton
2+
import QtQuick 2.15
3+
4+
QtObject {
5+
property bool dark: false
6+
property QtObject color: QtObject {
7+
property color white: "#FFFFFF"
8+
property color background: dark ? "black" : "white"
9+
property color orange: dark ? "#F89B2A" : "#F7931A"
10+
property color red: dark ? "#EC6363" : "#EB5757"
11+
property color green: dark ? "#36B46B" : "#27AE60"
12+
property color blue: dark ? "#3CA3DE" : "#2D9CDB"
13+
property color purple: dark ? "#C075DC" : "#BB6BD9"
14+
property color neutral0: dark ? "#000000" : "#FFFFFF"
15+
property color neutral1: dark ? "#1A1A1A" : "#F8F8F8"
16+
property color neutral2: dark ? "#2D2D2D" : "#F4F4F4"
17+
property color neutral3: dark ? "#444444" : "#EDEDED"
18+
property color neutral4: dark ? "#5C5C5C" : "#DEDEDE"
19+
property color neutral5: dark ? "#787878" : "#BBBBBB"
20+
property color neutral6: dark ? "#949494" : "#999999"
21+
property color neutral7: dark ? "#B0B0B0" : "#777777"
22+
property color neutral8: dark ? "#CCCCCC" : "#404040"
23+
property color neutral9: dark ? "#FFFFFF" : "#000000"
24+
}
25+
function toggleDark() {
26+
dark = !dark
27+
}
28+
}

src/qml/controls/qmldir

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
singleton Theme 1.0 Theme.qml

0 commit comments

Comments
 (0)