Class ColorExtensions
- Namespace
- Fantas
- Assembly
- Fantas.dll
Contains Color extensions
Implementation code took from Allegro and Troll2D: https://github.com/liballeg/allegro5/blob/master/addons/color/color.c https://github.com/viniciusjarina/troll2d/blob/master/include/troll/color.h
public static class ColorExtensions
- Inheritance
-
ColorExtensions
- Inherited Members
Methods
FromHSL(float, float, float)
Create a Color using hue, saturation and lightness
public static Color FromHSL(float hue, float saturation, float lightness)
Parameters
Returns
Invert(Color)
Invert the color components RGB (it preserves the alpha) Ex 0,0,255 -> 255,255,0
public static Color Invert(this Color self)
Parameters
self
Color
Returns
Lerp(Color, Color, float)
Performs linear interpolation of Color.
public static Color Lerp(this Color value1, Color value2, float amount)
Parameters
Returns
ToHSL(Color, out float, out float, out float)
Get the color components as Hue, Saturation and Lightness
public static void ToHSL(this Color self, out float hue, out float saturation, out float lightness)
Parameters
self
Colorhue
floatHue component (0-360)
saturation
floatSaturation (0f..1f)
lightness
floatLightness(0f..1f)
WithAlpha(Color, float)
Create a new color with new alpha value (0-1f)
public static Color WithAlpha(this Color self, float alpha)
Parameters
Returns
WithBrightness(Color, float)
Create a new color updating the lightness
public static Color WithBrightness(this Color self, float delta)
Parameters
Returns
WithRotatedHue(Color, float)
Create a new color with Hue rotated
public static Color WithRotatedHue(this Color self, float angle)
Parameters
Returns
WithSaturation(Color, float)
Create a new color with new saturation
public static Color WithSaturation(this Color self, float delta)