Table of Contents

Class ColorHelper

Namespace
HelixToolkit.Wpf
Assembly
HelixToolkit.Wpf.dll

Helper methods for Color.

public static class ColorHelper
Inheritance
ColorHelper
Inherited Members

Fields

UndefinedColor

The undefined color #00000000.

public static readonly Color UndefinedColor

Field Value

Color

Methods

ChangeAlpha(Color, byte)

Change the alpha value of a color

public static Color ChangeAlpha(this Color c, byte alpha)

Parameters

c Color
alpha byte

Returns

Color

ChangeIntensity(Color, double)

Changes the intensity.

public static Color ChangeIntensity(this Color c, double factor)

Parameters

c Color

The c.

factor double

The factor.

Returns

Color

ColorDifference(Color, Color)

Calculates the difference between two Colors

public static double ColorDifference(Color c1, Color c2)

Parameters

c1 Color
c2 Color

Returns

double

L2-norm in RGBA space

ColorToHex(Color)

Convert a Color to a hexadecimal string.

public static string ColorToHex(Color color)

Parameters

color Color

Returns

string

The color to hex.

ColorToHsv(Color)

Converts from a Color to HSV values (double)

public static double[] ColorToHsv(Color color)

Parameters

color Color

Returns

double[]

Array of [Hue,Saturation,Value] in the range [0,1]

ColorToHsvBytes(Color)

Converts from a Color to HSV values (byte)

public static byte[] ColorToHsvBytes(Color color)

Parameters

color Color

Returns

byte[]

Array of [Hue,Saturation,Value] in the range [0,255]

ColorToUint(Color)

Convert a Color to unsigned int

public static uint ColorToUint(Color c)

Parameters

c Color

Returns

uint

The color to uint.

Complementary(Color)

Calculates the complementary color

public static Color Complementary(Color c)

Parameters

c Color

Returns

Color

HexToColor(string)

Convert a hexadecimal string to Color.

public static Color HexToColor(string value)

Parameters

value string

Returns

Color

HsvToColor(byte, byte, byte)

Converts from HSV to a RGB Color

public static Color HsvToColor(byte hue, byte saturation, byte value)

Parameters

hue byte

The hue.

saturation byte

The saturation.

value byte

The value.

Returns

Color

HsvToColor(double, double, double)

public static Color HsvToColor(double hue, double sat, double val)

Parameters

hue double

Hue [0,1]

sat double

Saturation [0,1]

val double

Value [0,1]

Returns

Color

HsvToColor(double[])

Create a color from the specified HSV.

public static Color HsvToColor(double[] hsv)

Parameters

hsv double[]

The HSV.

Returns

Color

A color.

HueDifference(Color, Color)

Calculate the difference in hue between two Colors.

public static double HueDifference(Color c1, Color c2)

Parameters

c1 Color
c2 Color

Returns

double

The hue difference.

Interpolate(Color, Color, double)

Linear interpolation between two Colors.

public static Color Interpolate(Color c0, Color c1, double x)

Parameters

c0 Color
c1 Color
x double

Returns

Color

UIntToColor(uint)

Convert an unsigned int (32bit) to Color

public static Color UIntToColor(uint color)

Parameters

color uint

Returns

Color