-
Notifications
You must be signed in to change notification settings - Fork 7
/
themeconfig.slint
executable file
·76 lines (67 loc) · 2.16 KB
/
themeconfig.slint
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import { VerticalBox, HorizontalBox, ScrollView } from "std-widgets.slint";
import {Theme, JsonTheme} from "globals.slint";
export global ThemeCallbacks {
pure callback theme-changed(int, JsonTheme);
in property<[JsonTheme]> themes;
}
component ThemeBar inherits Rectangle {
in property<color> acc-color: Theme.accent;
in property<color> bg-color: Theme.background;
in property<color> txt-color: Theme.foreground;
in property<string> name: "Pomotroid";
in-out property<bool> selected: false;
callback select;
width: 80%;
height: 50px;
background: root.bg-color;
border-radius: 5px;
thm-ta := TouchArea {
clicked => { root.select();}
}
accent := Rectangle {
x: 0;
height: 100%;
background: root.acc-color;
width: 1%;
}
Text {
x: parent.width * 0.05;
horizontal-alignment: left;
text: root.name;
color: root.txt-color;
font-size: 11pt;
}
Image {
x: parent.width - 10px - self.width;
source: @image-url("../assets/icons/check.svg");
height: 50%;
visible: parent.selected;
colorize: Theme.accent;
}
}
export component ThemePage inherits Rectangle {
background: Theme.background-light;
in-out property<int> active-theme: Theme.theme-idx;
in property<[JsonTheme]> themes: ThemeCallbacks.themes;
VerticalBox {
ScrollView {
VerticalBox {
Text {
text: "Themes";
font-size: 11pt;
horizontal-alignment: center;
}
for disp-theme[idx] in root.themes : ThemeBar {
acc-color: disp-theme.accent;
bg-color: disp-theme.background;
txt-color: disp-theme.foreground;
name: disp-theme.name;
selected: root.active-theme == idx;
select => {
ThemeCallbacks.theme-changed(idx, disp-theme);
}
}
}
}
}
}