Expose color id for custom colors

This commit is contained in:
Atony committed 2026-10-30 15:05:52 -05:00
1 parent 890fa065e7
commit 6f3fee3859
2 files changed
+10

No files matched your search

+5
View File
@@ -48,6 +48,11 @@ public class CustomColor(StringNames name, Color32 mainColor, Color32 shadowColo
/// </summary>
public StringNames Name { get; set; } = name;
/// <summary>
/// Gets the id of the color.
/// </summary>
public int ColorId { get; internal set; } = -1;
/// <summary>
/// Gets or sets whether the color is lighter or darker. Can be used to help with colorblind stuff.
/// </summary>
+5
View File
@@ -50,6 +50,11 @@ public static class PaletteManager
var colors = CustomColors.Select(x => x.MainColor).ToArray();
var shadowColors = CustomColors.Select(x => x.ShadowColor).ToArray();
var stringNames = CustomColors.Select(x => x.Name).ToArray();
var newColorId = originalLength;
foreach (var color in CustomColors)
{
color.ColorId = newColorId++;
}
Palette.PlayerColors = Palette.PlayerColors.ToArray().AddRangeToArray(colors);
Palette.ShadowColors = Palette.ShadowColors.ToArray().AddRangeToArray(shadowColors);