diff --git a/MiraAPI/Colors/CustomColor.cs b/MiraAPI/Colors/CustomColor.cs
index a49e233..ea54e72 100644
--- a/MiraAPI/Colors/CustomColor.cs
+++ b/MiraAPI/Colors/CustomColor.cs
@@ -11,8 +11,8 @@ namespace MiraAPI.Colors;
/// The name of the option.
/// The main color.
/// The shadow color.
-[SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1513:Closing brace should be followed by blank line", Justification = "Looks weird.")]
[SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1401:Fields should be private", Justification = "Internal code.")]
+[SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1513:Closing brace should be followed by blank line", Justification = "Looks weird.")]
public class CustomColor(StringNames name, Color32 mainColor, Color32 shadowColor)
{
///
diff --git a/MiraAPI/Colors/VariableColorBehaviour.cs b/MiraAPI/Colors/VariableColorBehaviour.cs
index 2d6b6d0..dbc2e67 100644
--- a/MiraAPI/Colors/VariableColorBehaviour.cs
+++ b/MiraAPI/Colors/VariableColorBehaviour.cs
@@ -17,7 +17,6 @@ namespace MiraAPI;
public sealed class VariableColorBehaviour : MonoBehaviour
{
private SpriteRenderer rend;
- private Material material;
private VariableColor? color;
private static readonly Color VisorColor = Palette.VisorColor;
@@ -35,8 +34,7 @@ public sealed class VariableColorBehaviour : MonoBehaviour
private void Awake()
{
rend = GetComponent();
- material = rend.material;
- material.SetColor(ShaderID.VisorColor, VisorColor);
+ rend.material.SetColor(ShaderID.VisorColor, VisorColor);
}
private void Update()
@@ -45,6 +43,7 @@ public sealed class VariableColorBehaviour : MonoBehaviour
return;
var time = Time.time;
+ var material = rend.material;
material.SetColor(ShaderID.BodyColor, color.EvaluateMainColor(time));
material.SetColor(ShaderID.BackColor, color.EvaluateShadowColor(time));
}
diff --git a/MiraAPI/Patches/Hud/VariableColorPatches.cs b/MiraAPI/Patches/Hud/VariableColorPatches.cs
index 3b52b7b..9bf9e32 100644
--- a/MiraAPI/Patches/Hud/VariableColorPatches.cs
+++ b/MiraAPI/Patches/Hud/VariableColorPatches.cs
@@ -44,19 +44,15 @@ internal static class PlayerTabPatch
[HarmonyPatch(typeof(ChatNotification), nameof(ChatNotification.Update))]
internal static class ChatNotifRainbowPatch
{
+ private static readonly Regex RichTags = new(@"<[^>]*>", default, Regex.InfiniteMatchTimeout);
+
public static void Postfix(ChatNotification __instance)
{
if (!__instance.gameObject.active || !PaletteManager.IsVariable(__instance.player.cosmetics.ColorId))
return;
var str = PaletteManager.GetMainColor(__instance.player.cosmetics.ColorId).ToHtmlStringRGBA();
- __instance.playerNameText.text = "" + __instance.playerNameText.text.WithoutRichText();
- }
-
- private static string WithoutRichText(this string text)
- {
- var richTagRegex = new Regex(@"<[^>]*>", default, Regex.InfiniteMatchTimeout);
- return richTagRegex.Replace(text, string.Empty);
+ __instance.playerNameText.text = "" + RichTags.Replace(__instance.playerNameText.text, string.Empty);
}
}