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

fix GetColorValues returning ARGB instead of RGBA #175

Merged
merged 2 commits into from
Nov 19, 2023
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
<PackageVersion Include="Avalonia.Diagnostics" Version="$(AvaloniaVersion)" />
<PackageVersion Include="Avalonia.ReactiveUI" Version="$(AvaloniaVersion)" />
<PackageVersion Include="BepInEx.AssemblyPublicizer.MSBuild" Version="0.4.1" />
<PackageVersion Include="Flurl.Http" Version="4.0.0-pre4" />
<PackageVersion Include="Flurl.Http" Version="4.0.0-pre6" />
<PackageVersion Include="PuppeteerSharp" Version="6.2.0" />
<PackageVersion Include="ReactiveUI.Fody" Version="19.5.1" />
<PackageVersion Include="Semver" Version="2.3.0" />
<PackageVersion Include="PortableJsonSettingsProvider" Version="0.2.2" />
<PackageVersion Include="Gameloop.Vdf" Version="0.6.2" />
<PackageVersion Include="NLog" Version="5.2.5" />
<PackageVersion Include="NLog" Version="5.2.6" />
<PackageVersion Include="MinVer" Version="4.3.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
Expand All @@ -29,7 +29,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageVersion>
<PackageVersion Include="FileWatcherEx" Version="2.5.0" />
<PackageVersion Include="FileWatcherEx" Version="2.6.0" />
<PackageVersion Include="FluentAvaloniaUI" Version="2.0.4" />
<PackageVersion Include="WindowsShortcutFactory" Version="1.1.0" />
<PackageVersion Include="WmiLight" Version="4.0.0" />
Expand Down
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;
}

}
18 changes: 9 additions & 9 deletions SFP/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@
},
"FileWatcherEx": {
"type": "Direct",
"requested": "[2.5.0, )",
"resolved": "2.5.0",
"contentHash": "XmNJt94gt/xlr0RY5w6gKcZhwQ2wNSA7j+VqakpEHY3kk8dXVnYShNZMBVyEPUcDdCzFrI+4d7BvGnmDHB/m/w=="
"requested": "[2.6.0, )",
"resolved": "2.6.0",
"contentHash": "zHDfVCmqguDYzcRhUmsAzUVBMm5G3nvkD5+p3/f5TjqPHcxFvDoEfSKvxZ4/Mid6fVDZJOU+7xxittk+AIE2Bw=="
},
"Flurl.Http": {
"type": "Direct",
"requested": "[4.0.0-pre4, )",
"resolved": "4.0.0-pre4",
"contentHash": "gK20RSLGp1QBG7FCgu6/pmUUmhP6FGIRU0LBWWHdhTDicdHq760jP9QdD6UPyaVMLlhJrvwrSZ4HHLkHT8ZrjQ==",
"requested": "[4.0.0-pre6, )",
"resolved": "4.0.0-pre6",
"contentHash": "YwWbb/egekWqLmoYZLY2PTzwmN4l6/C4iQKuUsWuNrjxYQ84Oa+OBfQzPYx+04lpOAhhjoBeXFB8y7C+F0CpJA==",
"dependencies": {
"Flurl": "4.0.0-pre4"
}
Expand All @@ -54,9 +54,9 @@
},
"NLog": {
"type": "Direct",
"requested": "[5.2.5, )",
"resolved": "5.2.5",
"contentHash": "mMXtbAxfNzqkXcBjhJ3wN3rH7kwUZ0JL0GrUBI/lso7+tQ/HC4e5SnlmR3R5qQ9zWbqMbjxeH37rIf0yQGWTiA=="
"requested": "[5.2.6, )",
"resolved": "5.2.6",
"contentHash": "7/RQ4VBu6HT6kieczhwfI52ugcxrsrMNWIGy43Q36SdfN5dApZW7otsgXuIXx2rKspIGkPhD99JVWIs6FtIilA=="
},
"PortableJsonSettingsProvider": {
"type": "Direct",
Expand Down
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
24 changes: 12 additions & 12 deletions SFP_UI/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@
},
"NLog": {
"type": "Direct",
"requested": "[5.2.5, )",
"resolved": "5.2.5",
"contentHash": "mMXtbAxfNzqkXcBjhJ3wN3rH7kwUZ0JL0GrUBI/lso7+tQ/HC4e5SnlmR3R5qQ9zWbqMbjxeH37rIf0yQGWTiA=="
"requested": "[5.2.6, )",
"resolved": "5.2.6",
"contentHash": "7/RQ4VBu6HT6kieczhwfI52ugcxrsrMNWIGy43Q36SdfN5dApZW7otsgXuIXx2rKspIGkPhD99JVWIs6FtIilA=="
},
"ReactiveUI.Fody": {
"type": "Direct",
Expand Down Expand Up @@ -1525,10 +1525,10 @@
"sfp": {
"type": "Project",
"dependencies": {
"FileWatcherEx": "[2.5.0, )",
"Flurl.Http": "[4.0.0-pre4, )",
"FileWatcherEx": "[2.6.0, )",
"Flurl.Http": "[4.0.0-pre6, )",
"Gameloop.Vdf": "[0.6.2, )",
"NLog": "[5.2.5, )",
"NLog": "[5.2.6, )",
"PortableJsonSettingsProvider": "[0.2.2, )",
"PuppeteerSharp": "[6.2.0, )",
"WindowsShortcutFactory": "[1.1.0, )",
Expand All @@ -1537,15 +1537,15 @@
},
"FileWatcherEx": {
"type": "CentralTransitive",
"requested": "[2.5.0, )",
"resolved": "2.5.0",
"contentHash": "XmNJt94gt/xlr0RY5w6gKcZhwQ2wNSA7j+VqakpEHY3kk8dXVnYShNZMBVyEPUcDdCzFrI+4d7BvGnmDHB/m/w=="
"requested": "[2.6.0, )",
"resolved": "2.6.0",
"contentHash": "zHDfVCmqguDYzcRhUmsAzUVBMm5G3nvkD5+p3/f5TjqPHcxFvDoEfSKvxZ4/Mid6fVDZJOU+7xxittk+AIE2Bw=="
},
"Flurl.Http": {
"type": "CentralTransitive",
"requested": "[4.0.0-pre4, )",
"resolved": "4.0.0-pre4",
"contentHash": "gK20RSLGp1QBG7FCgu6/pmUUmhP6FGIRU0LBWWHdhTDicdHq760jP9QdD6UPyaVMLlhJrvwrSZ4HHLkHT8ZrjQ==",
"requested": "[4.0.0-pre6, )",
"resolved": "4.0.0-pre6",
"contentHash": "YwWbb/egekWqLmoYZLY2PTzwmN4l6/C4iQKuUsWuNrjxYQ84Oa+OBfQzPYx+04lpOAhhjoBeXFB8y7C+F0CpJA==",
"dependencies": {
"Flurl": "4.0.0-pre4"
}
Expand Down