Skip to content

Commit

Permalink
fix GetColorValues returning ARGB instead of RGBA
Browse files Browse the repository at this point in the history
  • Loading branch information
PhantomGamers committed Nov 19, 2023
1 parent 5a1edc7 commit 92af6a2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
12 changes: 12 additions & 0 deletions SFP/Models/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,16 @@ public static List<string> GetCommandLine(Process? process)

return new List<string>();
}

public static string ConvertARGBtoRGBA(string argb)
{
if (argb.Length != 9 || !argb.StartsWith("#"))
{
throw new ArgumentException("Invalid ARGB format");
}
var alpha = argb.Substring(1, 2);
var rgb = argb[3..];
return "#" + rgb + alpha;
}

}
6 changes: 5 additions & 1 deletion SFP_UI/App.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,20 @@ private static IEnumerable<string> GetColorValues()
{
if (Current!.Styles[0] is not FluentAvaloniaTheme faTheme)
{
Log.Logger.Warn("Could not get color values, FluentAvaloniaTheme is null");
return Array.Empty<string>();
}
var colorValues = new string[7];
for (var i = 0; i < 7; i++)
{
if (!faTheme.Resources.TryGetResource(Injector.ColorNames[i], null, out var c))
{
Log.Logger.Warn("Could not get color value for {ColorName}", Injector.ColorNames[i]);
continue;
}
colorValues[i] = c?.ToString() ?? colorValues[i];

var rgbaStr = Utils.ConvertARGBtoRGBA(c!.ToString()!);
colorValues[i] = rgbaStr;
}

return colorValues;
Expand Down

0 comments on commit 92af6a2

Please sign in to comment.