Skip to content

Commit

Permalink
Explicitly forbid dark screenshots if not prefering dark mode
Browse files Browse the repository at this point in the history
  • Loading branch information
italo-capasso committed Dec 8, 2024
1 parent d118d0a commit aecdacc
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Views/AppInfoView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -945,14 +945,15 @@ public class AppCenter.Views.AppInfoView : Adw.NavigationPage {
var prefer_dark_theme = Gtk.Settings.get_default ().gtk_application_prefer_dark_theme;
screenshots.foreach ((screenshot) => {
var environment_id = screenshot.get_environment ();
if (prefer_dark_theme && environment_id != null) {
if (environment_id != null) {
var environment_split = environment_id.split (":", 2);
if (environment_split.length != 2) {
if (prefer_dark_theme && environment_split.length != 2) {
return;
}

var color_scheme = AppStream.ColorSchemeKind.from_string (environment_split[1]);
if (color_scheme != AppStream.ColorSchemeKind.DARK) {
if ((prefer_dark_theme && color_scheme != AppStream.ColorSchemeKind.DARK) ||
(!prefer_dark_theme && color_scheme == AppStream.ColorSchemeKind.DARK)) {
return;
}
}
Expand Down

0 comments on commit aecdacc

Please sign in to comment.