Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Init: set accent color from portal feedback #722

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions lib/Widgets/Settings.vala
Original file line number Diff line number Diff line change
Expand Up @@ -124,29 +124,27 @@ namespace Granite {
"accent-color"
).get_variant ();

update_color (variant);
accent_color = parse_color (variant);

portal.setting_changed.connect ((scheme, key, value) => {
if (scheme == "org.freedesktop.appearance" && key == "accent-color") {
update_color (value);
accent_color = parse_color (value);
}
});

return;
} catch (Error e) {
debug (e.message);
}
warning (e.message);

// Set a default in case we can't get from system
accent_color = "#3689e6";
// Set a default in case we can't get from system
accent_color = "#3689e6";
}
}

private void update_color (GLib.Variant color) {
private string parse_color (GLib.Variant color) {
double red, green, blue;
color.get ("(ddd)", out red, out green, out blue);

Gdk.RGBA rgba = {(float) red, (float) green, (float) blue, 1};
accent_color = rgba.to_string ();
return rgba.to_string ();
}

private void setup_prefers_color_scheme () {
Expand Down
Loading