Files
cfs-Tracker/Helpers/HealthStateExtensions.cs
T
Djagor d85f2e0fb3 Farbpalette vorladen lassen
Bootstraper läd jetzt die farbeinstellung sofort und nicht nachträglich

cleanup and rework

PDF switch to HTML

export fix

Colorsystem

Farben für knöpfe hinzugefügt als anpassung

button color

button color primary and secondary change
2026-03-24 21:59:59 +01:00

43 lines
1.3 KiB
C#

using cfs_tracker.Models;
namespace cfs_tracker.Helpers;
public static class HealthStateExtensions
{
public static string ToAppearanceColorKey(this HealthState state) => state switch
{
HealthState.Green => AppearanceKeys.StateGreen,
HealthState.Yellow => AppearanceKeys.StateYellow,
HealthState.Red => AppearanceKeys.StateRed,
HealthState.Gray => AppearanceKeys.StateGray,
_ => AppearanceKeys.StateGray
};
public static string ToAppearanceTextKey(this HealthState state) => state switch
{
HealthState.Green => AppearanceKeys.StatusGreenText,
HealthState.Yellow => AppearanceKeys.StatusYellowText,
HealthState.Red => AppearanceKeys.StatusRedText,
HealthState.Gray => AppearanceKeys.StatusGrayText,
_ => AppearanceKeys.StatusGrayText
};
public static string ToFallbackText(this HealthState state) => state switch
{
HealthState.Green => "Grün",
HealthState.Yellow => "Gelb",
HealthState.Red => "Rot",
HealthState.Gray => "Schwarz",
_ => "Schwarz"
};
public static int ToScore(this HealthState state) => state switch
{
HealthState.Green => 3,
HealthState.Yellow => 2,
HealthState.Red => 1,
HealthState.Gray => 0,
_ => 0
};
}