Skip to content

Commit 97cce6d

Browse files
committed
feat: add accent color swatches UI to preferences
NOTE: this is still like the frontend so they are not functional yet :( but I am gonna work on it on weekends, gotta finish some academics stuff first
1 parent 06473a1 commit 97cce6d

2 files changed

Lines changed: 123 additions & 0 deletions

File tree

‎src/preferences-dialog.blp‎

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,93 @@ Adw.PreferencesDialog preferences_dialog {
2222
//TODO: add more performance related settings
2323
}
2424

25+
Adw.PreferencesGroup {
26+
title: _("Appearance");
27+
description: _("Accent color for Memerist only. Reset to follow the system.");
28+
29+
header-suffix: Gtk.Button accent_reset_button {
30+
label: _("Reset");
31+
valign: center;
32+
styles ["flat"]
33+
};
34+
35+
Adw.PreferencesRow {
36+
activatable: false;
37+
38+
child: Gtk.Box {
39+
halign: center;
40+
spacing: 14;
41+
margin-top: 18;
42+
margin-bottom: 18;
43+
margin-start: 12;
44+
margin-end: 12;
45+
46+
Gtk.CheckButton {
47+
styles ["accent-swatch", "blue"]
48+
action-name: "prefs.accent-color";
49+
action-target: "'blue'";
50+
tooltip-text: _("Blue");
51+
}
52+
53+
Gtk.CheckButton {
54+
styles ["accent-swatch", "teal"]
55+
action-name: "prefs.accent-color";
56+
action-target: "'teal'";
57+
tooltip-text: _("Teal");
58+
}
59+
60+
Gtk.CheckButton {
61+
styles ["accent-swatch", "green"]
62+
action-name: "prefs.accent-color";
63+
action-target: "'green'";
64+
tooltip-text: _("Green");
65+
}
66+
67+
Gtk.CheckButton {
68+
styles ["accent-swatch", "yellow"]
69+
action-name: "prefs.accent-color";
70+
action-target: "'yellow'";
71+
tooltip-text: _("Yellow");
72+
}
73+
74+
Gtk.CheckButton {
75+
styles ["accent-swatch", "orange"]
76+
action-name: "prefs.accent-color";
77+
action-target: "'orange'";
78+
tooltip-text: _("Orange");
79+
}
80+
81+
Gtk.CheckButton {
82+
styles ["accent-swatch", "red"]
83+
action-name: "prefs.accent-color";
84+
action-target: "'red'";
85+
tooltip-text: _("Red");
86+
}
87+
88+
Gtk.CheckButton {
89+
styles ["accent-swatch", "pink"]
90+
action-name: "prefs.accent-color";
91+
action-target: "'pink'";
92+
tooltip-text: _("Pink");
93+
}
94+
95+
Gtk.CheckButton {
96+
styles ["accent-swatch", "purple"]
97+
action-name: "prefs.accent-color";
98+
action-target: "'purple'";
99+
tooltip-text: _("Purple");
100+
}
101+
102+
Gtk.CheckButton {
103+
styles ["accent-swatch", "slate"]
104+
action-name: "prefs.accent-color";
105+
action-target: "'slate'";
106+
tooltip-text: _("Slate");
107+
}
108+
};
109+
}
110+
}
111+
25112
// TODO: Add more Adw.PreferencesGroup blocks here for other settings categories
26113
}
27114
}

‎src/style.css‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,39 @@
4242
.theme-switcher checkbutton.dark radio {
4343
background-color: var(--dark-bg);
4444
}
45+
46+
checkbutton.accent-swatch {
47+
padding: 3px;
48+
border: 3px solid transparent;
49+
border-radius: 9999px;
50+
min-width: 0;
51+
min-height: 0;
52+
}
53+
54+
checkbutton.accent-swatch:checked {
55+
border-color: var(--swatch);
56+
}
57+
58+
checkbutton.accent-swatch radio,
59+
checkbutton.accent-swatch radio:checked {
60+
-gtk-icon-source: none;
61+
background-image: none;
62+
background-color: var(--swatch);
63+
min-width: 24px;
64+
min-height: 24px;
65+
padding: 0;
66+
margin: 0;
67+
border: none;
68+
box-shadow: none;
69+
border-radius: 9999px;
70+
}
71+
72+
.accent-swatch.blue { --swatch: #3584e4; }
73+
.accent-swatch.teal { --swatch: #2190a4; }
74+
.accent-swatch.green { --swatch: #3a944a; }
75+
.accent-swatch.yellow { --swatch: #c88800; }
76+
.accent-swatch.orange { --swatch: #ed5b00; }
77+
.accent-swatch.red { --swatch: #e62d42; }
78+
.accent-swatch.pink { --swatch: #d56199; }
79+
.accent-swatch.purple { --swatch: #9141ac; }
80+
.accent-swatch.slate { --swatch: #6f8396; }

0 commit comments

Comments
 (0)