UI/HudAppearance.cs
using System;
namespace Prototype;
public static class HudAppearance
{
public static string Hue(float hue, float saturation = 1f)
{
var h = Math.Clamp(hue,0f,360f)/60f;
var x = 1f-MathF.Abs(h%2f-1f);
var (r,g,b) = h switch { <1 => (1f,x,0f), <2 => (x,1f,0f), <3 => (0f,1f,x), <4 => (0f,x,1f), <5 => (x,0f,1f), _ => (1f,0f,x) };
r=1f+(r-1f)*saturation; g=1f+(g-1f)*saturation; b=1f+(b-1f)*saturation;
return $"#{(int)(r*255):X2}{(int)(g*255):X2}{(int)(b*255):X2}";
}
public static string FeedbackColor(float hue) => hue < 0f ? "#F3F7FA" : Hue(hue, .7f);
public static string DamageStyle(GameSettingsData s) => FormattableString.Invariant($"font-size:{s.DamageTextSize}px; color:{Hue(s.DamageHue,s.DamageSaturation)}; font-weight:700; letter-spacing:0px;");
}