@@ -17,6 +17,31 @@ CustomDialog {
17
17
ThemeEngine .reloadTheme ();
18
18
}
19
19
20
+ QtObject {
21
+ id: priv
22
+ property int accentColorIndex: - 1
23
+
24
+ readonly property list< color> darkAccentColors: [
25
+ Qt .rgba (0.85 , 0.31 , 0.33 , 1 ),
26
+ Qt .rgba (0.85 , 0.62 , 0.31 , 1 ),
27
+ Qt .rgba (0.85 , 0.84 , 0.31 , 1 ),
28
+ Qt .rgba (0.39 , 0.85 , 0.31 , 1 ),
29
+ Qt .rgba (0.31 , 0.75 , 0.85 , 1 ),
30
+ Qt .rgba (0.32 , 0.32 , 0.85 , 1 ),
31
+ Qt .rgba (0.68 , 0.31 , 0.85 , 1 ),
32
+ ]
33
+
34
+ readonly property list< color> lightAccentColors: [
35
+ Qt .rgba (0.75 , 0.08 , 0.09 , 1 ),
36
+ Qt .rgba (0.75 , 0.47 , 0.08 , 1 ),
37
+ Qt .rgba (0.75 , 0.74 , 0.08 , 1 ),
38
+ Qt .rgba (0.17 , 0.75 , 0.08 , 1 ),
39
+ Qt .rgba (0.08 , 0.63 , 0.75 , 1 ),
40
+ Qt .rgba (0.08 , 0.08 , 0.75 , 1 ),
41
+ Qt .rgba (0.54 , 0.08 , 0.75 , 1 ),
42
+ ]
43
+ }
44
+
20
45
contentItem: ColumnLayout {
21
46
// Themes
22
47
Label {
@@ -38,5 +63,47 @@ CustomDialog {
38
63
onCheckedChanged: if (checked) ThemeEngine .theme = ThemeEngine .DarkTheme
39
64
}
40
65
}
66
+
67
+ RowLayout {
68
+ Label {
69
+ text: qsTr (" Accent color:" )
70
+ }
71
+
72
+ Repeater {
73
+ id: accentColors
74
+ model: ThemeEngine .theme == ThemeEngine .DarkTheme ? priv .darkAccentColors : priv .lightAccentColors
75
+
76
+ ColorButton {
77
+ required property color modelData
78
+ required property int index
79
+ color: modelData
80
+ checked: {
81
+ if (ThemeEngine .accentColor === modelData) {
82
+ priv .accentColorIndex = index;
83
+ return true ;
84
+ } else {
85
+ return false ;
86
+ }
87
+ }
88
+ autoExclusive: true
89
+ checkable: true
90
+ onPressed: ThemeEngine .accentColor = modelData;
91
+ }
92
+ }
93
+ }
94
+
95
+ Connections {
96
+ target: ThemeEngine
97
+
98
+ function onThemeChanged () {
99
+ console .log (priv .accentColorIndex , ThemeEngine .theme );
100
+
101
+ if (ThemeEngine .theme == ThemeEngine .DarkTheme ) {
102
+ ThemeEngine .accentColor = priv .darkAccentColors [priv .accentColorIndex ];
103
+ } else {
104
+ ThemeEngine .accentColor = priv .lightAccentColors [priv .accentColorIndex ];
105
+ }
106
+ }
107
+ }
41
108
}
42
109
}
0 commit comments