Skip to content

Commit

Permalink
finally fixed it
Browse files Browse the repository at this point in the history
  • Loading branch information
lainsce committed Jan 24, 2023
1 parent 5f571e9 commit c0cb440
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
6 changes: 3 additions & 3 deletions lib/Models/Application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,14 @@ public class He.Application : Gtk.Application {
private void update_accent_color() {
He.Color.RGBColor rgb_color;

if (desktop.accent_color != null) {
rgb_color = He.Color.from_hex(desktop.accent_color);
} else {
if (desktop.accent_color == null) {
if (default_accent_color != null) {
rgb_color = default_accent_color;
} else {
rgb_color = Desktop.ColorScheme.DARK == desktop.prefers_color_scheme ? default_dark_accent : default_light_accent;
}
} else {
rgb_color = desktop.accent_color;
}

var lch_color = He.Color.rgb_to_lch (rgb_color);
Expand Down
18 changes: 10 additions & 8 deletions lib/Utils/Desktop.vala
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ public class He.Desktop : Object {
/**
* The accent color preference.
*/
private string? _accent_color;
public string? accent_color {
private He.Color.RGBColor? _accent_color;
public He.Color.RGBColor? accent_color {
get {
return _accent_color;
}
Expand All @@ -126,12 +126,14 @@ public class He.Desktop : Object {
"accent-color"
).get_variant ();

if (accent.get_type().equal(VariantType.UINT32)) {
if (accent.get_string () == "#multi") {
accent_color = null;
return;
}

accent_color = accent.get_string ();

string color = accent.get_string ();
accent_color = He.Color.from_hex(color);
return;
} catch (Error e) {
debug ("%s", e.message);
}
Expand All @@ -142,12 +144,12 @@ public class He.Desktop : Object {
private void init_handle_settings_change() {
portal.setting_changed.connect ((scheme, key, val) => {
if (scheme == "org.freedesktop.appearance" && key == "accent-color") {
if (val.get_type().equal(VariantType.UINT32)) {
if (val.get_string () == "#multi") {
accent_color = null;
return;
}

accent_color = (string) val.get_string ();
string color = val.get_string ();
accent_color = He.Color.from_hex(color);
}

if (scheme == "org.freedesktop.appearance" && key == "dark-mode-strength") {
Expand Down

0 comments on commit c0cb440

Please sign in to comment.