TomlDataReader, documentation updates, move ParticleSystem to Voile.Systems.Particles.
This commit is contained in:
@@ -78,6 +78,29 @@ namespace Voile
|
||||
R = (hex & 0xFF) / 255.0f;
|
||||
}
|
||||
|
||||
public static Color FromHexString(string hex)
|
||||
{
|
||||
if (hex.StartsWith("#"))
|
||||
{
|
||||
hex = hex[1..];
|
||||
}
|
||||
|
||||
if (hex.Length == 6)
|
||||
{
|
||||
int rgb = int.Parse(hex, System.Globalization.NumberStyles.HexNumber);
|
||||
return new Color(rgb);
|
||||
}
|
||||
else if (hex.Length == 8)
|
||||
{
|
||||
int rgba = int.Parse(hex, System.Globalization.NumberStyles.HexNumber);
|
||||
return new Color(rgba);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ArgumentException("Invalid hex color format. Use #RRGGBB or #RRGGBBAA.");
|
||||
}
|
||||
}
|
||||
|
||||
public Color Lightened(float amount)
|
||||
{
|
||||
var result = this;
|
||||
|
||||
Reference in New Issue
Block a user