From 6f3fee3859cca20a5689212c3171828769cad4e2 Mon Sep 17 00:00:00 2001
From: Atony <75191600+AtonyGit@users.noreply.github.com>
Date: Fri, 30 Oct 2026 15:05:52 -0500
Subject: [PATCH] Expose color id for custom colors
---
MiraAPI/Colors/CustomColor.cs | 5 +++++
MiraAPI/Colors/PaletteManager.cs | 5 +++++
2 files changed, 10 insertions(+)
diff --git a/MiraAPI/Colors/CustomColor.cs b/MiraAPI/Colors/CustomColor.cs
index 996bb467..f3c38395 100644
--- a/MiraAPI/Colors/CustomColor.cs
+++ b/MiraAPI/Colors/CustomColor.cs
@@ -48,6 +48,11 @@ public class CustomColor(StringNames name, Color32 mainColor, Color32 shadowColo
///
public StringNames Name { get; set; } = name;
+ ///
+ /// Gets the id of the color.
+ ///
+ public int ColorId { get; internal set; } = -1;
+
///
/// Gets or sets whether the color is lighter or darker. Can be used to help with colorblind stuff.
///
diff --git a/MiraAPI/Colors/PaletteManager.cs b/MiraAPI/Colors/PaletteManager.cs
index 3b9cd4af..760822fc 100644
--- a/MiraAPI/Colors/PaletteManager.cs
+++ b/MiraAPI/Colors/PaletteManager.cs
@@ -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);