Initialize migration. (#88)

Co-authored-by: defnotken <itsdefnotken@gmail.com>
Co-authored-by: cake <admin@cakeandbanana.nl>
Reviewed-on: #88
Reviewed-by: cake <cake@noreply.git.lightless-sync.org>
Co-authored-by: defnotken <defnotken@noreply.git.lightless-sync.org>
Co-committed-by: defnotken <defnotken@noreply.git.lightless-sync.org>
This commit was merged in pull request #88.
This commit is contained in:
2025-11-29 18:02:39 +01:00
committed by cake
parent 9e12725f89
commit 740b58afc4
63 changed files with 1720 additions and 1005 deletions

View File

@@ -45,7 +45,7 @@ namespace LightlessSync.UI
return HexToRgba(customColorHex);
if (!DefaultHexColors.TryGetValue(name, out var hex))
throw new ArgumentException($"Color '{name}' not found in UIColors.");
throw new ArgumentException($"Color '{name}' not found in UIColors.", nameof(name));
return HexToRgba(hex);
}
@@ -53,7 +53,7 @@ namespace LightlessSync.UI
public static void Set(string name, Vector4 color)
{
if (!DefaultHexColors.ContainsKey(name))
throw new ArgumentException($"Color '{name}' not found in UIColors.");
throw new ArgumentException($"Color '{name}' not found in UIColors.", nameof(name));
if (_configService != null)
{
@@ -83,7 +83,7 @@ namespace LightlessSync.UI
public static Vector4 GetDefault(string name)
{
if (!DefaultHexColors.TryGetValue(name, out var hex))
throw new ArgumentException($"Color '{name}' not found in UIColors.");
throw new ArgumentException($"Color '{name}' not found in UIColors.", nameof(name));
return HexToRgba(hex);
}
@@ -101,10 +101,10 @@ namespace LightlessSync.UI
public static Vector4 HexToRgba(string hexColor)
{
hexColor = hexColor.TrimStart('#');
int r = int.Parse(hexColor.Substring(0, 2), NumberStyles.HexNumber);
int g = int.Parse(hexColor.Substring(2, 2), NumberStyles.HexNumber);
int b = int.Parse(hexColor.Substring(4, 2), NumberStyles.HexNumber);
int a = hexColor.Length == 8 ? int.Parse(hexColor.Substring(6, 2), NumberStyles.HexNumber) : 255;
int r = int.Parse(hexColor[..2], NumberStyles.HexNumber);
int g = int.Parse(hexColor[2..4], NumberStyles.HexNumber);
int b = int.Parse(hexColor[4..6], NumberStyles.HexNumber);
int a = hexColor.Length == 8 ? int.Parse(hexColor[6..8], NumberStyles.HexNumber) : 255;
return new Vector4(r / 255f, g / 255f, b / 255f, a / 255f);
}