Skip to content

Commit

Permalink
Parse all branding colors from appstream (#2140)
Browse files Browse the repository at this point in the history
This will attempt to find if the package branding has a  scheme_preference attribute, then select the appropiate primary color matching the prefer dark theme or not.
  • Loading branch information
italo-capasso committed Dec 9, 2024
1 parent 515b4d1 commit 1506b6b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Core/Package.vala
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,16 @@ public class AppCenterCore.Package : Object {
} else {
var branding = component.get_branding ();
if (branding != null) {
color_primary = branding.get_color (AppStream.ColorKind.PRIMARY, AppStream.ColorSchemeKind.UNKNOWN);
var gtk_settings = Gtk.Settings.get_default ();
if (gtk_settings.gtk_application_prefer_dark_theme){
color_primary = branding.get_color (AppStream.ColorKind.PRIMARY, AppStream.ColorSchemeKind.DARK);
} else {
color_primary = branding.get_color (AppStream.ColorKind.PRIMARY, AppStream.ColorSchemeKind.LIGHT);
}

if (color_primary == null){
color_primary = branding.get_color (AppStream.ColorKind.PRIMARY, AppStream.ColorSchemeKind.UNKNOWN);
}
}

if (color_primary == null) {
Expand Down

0 comments on commit 1506b6b

Please sign in to comment.