Table of Contents

Class ColorExtensions

Namespace
Fantas
Assembly
Fantas.dll
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

hue float
saturation float
lightness float

Returns

Color

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

Color

Lerp(Color, Color, float)

Performs linear interpolation of Color.

public static Color Lerp(this Color value1, Color value2, float amount)

Parameters

value1 Color

Source Color.

value2 Color

Destination Color.

amount float

Interpolation factor.

Returns

Color

Interpolated Color.

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 Color
hue float

Hue component (0-360)

saturation float

Saturation (0f..1f)

lightness float

Lightness(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

self Color
alpha float

Alpha from 0 to 1

Returns

Color

WithBrightness(Color, float)

Create a new color updating the lightness

public static Color WithBrightness(this Color self, float delta)

Parameters

self Color
delta float

Returns

Color

WithRotatedHue(Color, float)

Create a new color with Hue rotated

public static Color WithRotatedHue(this Color self, float angle)

Parameters

self Color

Color

angle float

Angle to rotate in degress (0-360)

Returns

Color

WithSaturation(Color, float)

Create a new color with new saturation

public static Color WithSaturation(this Color self, float delta)

Parameters

self Color
delta float

The amount to increase the saturation

Returns

Color