Skip to content

Commit

Permalink
feat: Allow disabling the icon background
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinZikmund committed Aug 6, 2024
1 parent ab50fa3 commit 108edd8
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/Resizetizer/src/ResizeImageInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ internal class ResizeImageInfo

public bool IsAppIcon { get; set; }

public bool UseIconBackground { get; set; }

public bool IsSplashScreen { get; set; }

public string? ForegroundFilename { get; set; }
Expand Down Expand Up @@ -138,7 +140,12 @@ public static List<ResizeImageInfo> Parse(IEnumerable<ITaskItem>? images)
info.ForegroundScale = fsc;
}

if (info.IsSplashScreen)
if (bool.TryParse(image.GetMetadata(nameof(UseIconBackground)), out var uib))
{
info.UseIconBackground = uib;
}

if (info.IsSplashScreen)
{
SetPlatformForegroundScale(image, "Scale", info);
ApplyPlatformScale(image, info);
Expand All @@ -154,6 +161,12 @@ public static List<ResizeImageInfo> Parse(IEnumerable<ITaskItem>? images)
}

info.ForegroundFilename = fgFileInfo.FullName;

// If we don't want to apply icon background, we set it to null.
if (!info.UseIconBackground)
{
info.Filename = null;
}
}

if (info.IsAppIcon)
Expand Down

0 comments on commit 108edd8

Please sign in to comment.