using Avalonia.Data.Converters;
namespace StarsAssistant.Views.Helpers;
public static class PlanetStyleConverters
{
///
/// Check, if the planet pop percentage is in the warning range
///
public static FuncValueConverter PopulationPercentWarning { get; }
= new((value) =>
{
return value switch
{
null => false,
> 0 and < 25 or > 33 and <= 50 => true,
_ => false
};
});
///
/// Check, if the planet pop percentage is in a bad range (overpop)
///
public static FuncValueConverter PopulationPercentBad { get; }
= new((value) =>
{
return value switch
{
null => false,
> 100 => true,
_ => false
};
});
///
/// Check, if the planet pop percentage is in a good range (growth-wise)
///
public static FuncValueConverter PopulationPercentGood { get; }
= new((value) =>
{
return value switch
{
null => false,
>= 25 and <= 33 => true,
_ => false
};
});
///
/// Check, if the planet pop percentage is not relevant (100%)
///
public static FuncValueConverter PopulationPercentInactive { get; }
= new((value) =>
{
return value switch
{
null => false,
> 99 and <= 100 => true,
_ => false
};
});
}