using System; using System.Globalization; using UnityEngine; namespace Luneraria.UI { /// /// Colours and number formats of the Champions of Luneraria HUD (port of /// scripts/luneraria/ui/theme/lune_ui_theme.gd and the colours of the Saumwacht menu theme it /// extends): dark blue-anthracite plates, bronze and gold only on what the player can act on, /// quiet team accents. Colours are sRGB, as in Godot. /// public static class LuneUiTheme { public static readonly Color SlateTop = new Color(.075f, .1f, .135f, .9f); public static readonly Color SlateBottom = new Color(.05f, .068f, .094f, .93f); public static readonly Color Edge = Hex("2b3848"); public static readonly Color EdgeLight = Hex("455870"); public static readonly Color Text = Hex("ebe5d8"); public static readonly Color Bright = Hex("f6eedc"); public static readonly Color Muted = Hex("9aa4b0"); public static readonly Color Faint = Hex("6a7480"); public static readonly Color Gold = Hex("f2c96b"); // Saumwacht menu theme (saumwacht_theme.gd). public static readonly Color Bronze = Hex("b7874a"); public static readonly Color BronzeLight = Hex("e4bd7c"); public static readonly Color BronzeDeep = Hex("6b4f2e"); public static readonly Color Ink = Hex("1a120a"); public static readonly Color Focus = Hex("f6e2b0"); public static readonly Color Parchment = Hex("efe6d2"); /// Team accents: Blau (cool, crescent moon), Rot (warm, sun disc), neutral grotto (violet). public static readonly Color[] Team = { Hex("6cb4ff"), Hex("ff7b5e"), Hex("b78cff") }; public static readonly Color[] TeamDark = { Hex("1c3f6a"), Hex("722a1f"), Hex("45305f") }; public static readonly string[] TeamNames = { "Blau", "Rot", "Grotte" }; public static readonly string[] TeamEmblems = { "Mondsichel", "Sonnenscheibe", "Grotte" }; /// Threat levels RUHIG, UMKÄMPFT, UNTER DRUCK, KRITISCH. public static readonly Color[] Threat = { Hex("7cc9a6"), Hex("e5c35e"), Hex("ff9448"), Hex("ff584a") }; public static readonly Color Champion = Hex("e2a15e"); public static readonly Color Hero = Hex("f2c96b"); public static readonly Color Good = Hex("8fdcb4"); public static readonly Color Warn = Hex("f0c060"); public static readonly Color Danger = Hex("ff6a55"); public static readonly Color Info = Hex("a9c6e8"); /// Lower bound for any HUD text: 14 logical px stay above 10 px at 1280×720. public const int MinFont = 14; public static Color Hex(string hex) { if (!ColorUtility.TryParseHtmlString("#" + hex, out Color color)) throw new ArgumentException("Bad colour " + hex); return color; } /// Godot Color.darkened: rgb times (1 - amount), alpha kept. public static Color Darkened(Color color, float amount) { return new Color(color.r * (1f - amount), color.g * (1f - amount), color.b * (1f - amount), color.a); } /// Godot Color.lightened: rgb towards white by amount, alpha kept. public static Color Lightened(Color color, float amount) { return new Color(color.r + (1f - color.r) * amount, color.g + (1f - color.g) * amount, color.b + (1f - color.b) * amount, color.a); } public static Color WithAlpha(Color color, float alpha) { return new Color(color.r, color.g, color.b, alpha); } public static Color TeamColor(int team) { return Team[Mathf.Clamp(team, 0, 2)]; } public static string TeamName(int team) { return TeamNames[Mathf.Clamp(team, 0, 2)]; } /// Whole numbers with German thousands separators (12.000), rounded like Godot (half away from zero). public static string Number(double value) { long whole = (long)Math.Round(value, MidpointRounding.AwayFromZero); string digits = Math.Abs(whole).ToString(CultureInfo.InvariantCulture); string result = ""; while (digits.Length > 3) { result = "." + digits.Substring(digits.Length - 3) + result; digits = digits.Substring(0, digits.Length - 3); } return (whole < 0 ? "-" : "") + digits + result; } /// Fixed decimals with a decimal comma (Godot: "%.1f" % value with "." replaced). public static string Decimal(double value, int places = 1) { return value.ToString("F" + places, CultureInfo.InvariantCulture).Replace(".", ","); } /// Godot round(): half away from zero. public static int Round(double value) { return (int)Math.Round(value, MidpointRounding.AwayFromZero); } } }