Utility class for color-based operations.

Inheritance

Converts a color to its integer representation for use in bitmaps.

public static int ColorToInt(Color color)

Parameters

  • color: Color

Returns any

public static string ColorToString(Color c, bool useRgba)

Parameters

  • c: Color
  • useRgba: bool

Returns any

FromAHSL(double, double, double, double)

Section titled "FromAHSL(double, double, double, double)"

Gets a color from the specified ahsl components

public static Color FromAHSL(double alpha, double hue, double saturation, double lightness)

Parameters

  • alpha: double
  • hue: double
  • saturation: double
  • lightness: double

Returns any

FromAHSV(double, double, double, double)

Section titled "FromAHSV(double, double, double, double)"

Gets a color from the specified ahsv components

public static Color FromAHSV(double alpha, double hue, double saturation, double value)

Parameters

  • alpha: double
  • hue: double
  • saturation: double
  • value: double

Returns any

Converts ARGB integer to a Color, e.g. -65536 (red pixel)

public static Color FromArgb(int argb)

Parameters

  • argb: int

Returns any

Converts ARGB string to a Color, e.g. '#AARRGGBB'

public static Color FromArgb(string hex)

Parameters

  • hex: string

Returns any

Converts color hex string to a Color, e.g. '#AARRGGBB', '#RRGGBB', or '#RGB'

public static Color FromHex(string colorHex)

Parameters

  • colorHex: string

Returns any

Converts RGB string a Color, e.g. 'RGB, R,G,B'

public static Color FromRGB(string rgb)

Parameters

  • rgb: string

Returns any

Converts RGBA string a Color, e.g. 'RGBA, R,G,B,A',

public static Color FromRGBA(string rgba)

Parameters

  • rgba: string

Returns any

Converts string format to a Color, e.g. 'DodgerBlue', '#AARRGGBB', '#RRGGBB', 'RGBA, R,G,B,A', or 'RGB, R,G,B'

public static Color FromString(string colorFormat)

Parameters

  • colorFormat: string

Returns any

Gets the ahsl components of this color

public static double[] GetAHSL(this Color color)

Parameters

  • color: Color

Returns any

Gets the ahsv components of this color

public static double[] GetAHSV(this Color color)

Parameters

  • color: Color

Returns any

GetAHSVInterpolation(double[], double, double[])

Section titled "GetAHSVInterpolation(double[], double, double[])"

Get an interpolated color between two colors.

public static Color GetAHSVInterpolation(double[] minimum, double interpolation, double[] maximum)

Parameters

  • minimum: double[]
  • interpolation: double
  • maximum: double[]

Returns any

Returns the main color of the given brush.

public static Color GetColor(Brush brush)

Parameters

  • brush: Brush

Returns any

GetInterpolation(Color, double, Color, InterpolationMode)

Section titled "GetInterpolation(Color, double, Color, InterpolationMode)"

Get an interpolation from the current color to the specified color

public static Color GetInterpolation(this Color minimum, double interpolation_, Color maximum_, InterpolationMode interpolationMode)

Parameters

  • minimum: Color
  • interpolation_: double
  • maximum_: Color
  • interpolationMode: InterpolationMode

Returns any

public static double GetL(this Color color)

Parameters

  • color: Color

Returns any

Get a random color from generated array of colors.

public static Color GetRandomColor(int index)

Parameters

  • index: int

Returns any

public static double[] GetsRGB(this Color color)

Parameters

  • color: Color

Returns any

public static Color RGBAToRGB(this Color color, Color background)

Parameters

  • color: Color
  • background: Color

Returns any

Returns a random color.

public static Color RandomColor(byte alpha)

Parameters

  • alpha: byte

Returns any

Get a random color

public static Color RandomHue(Color color)

Parameters

  • color: Color

Returns any

public static Color ToGrayscale(Color color)

Parameters

  • color: Color

Returns any