Components
The Color Pro package includes numerous extension methods for getting and setting components values on colors. These functions are declared in the static class Components.
Getting Components
Returns the component values of a color.
RGBA
float red = color.GetRed();
float green = color.GetGreen();
float blue = color.GetBlue();
float alpha = color.GetAlpha();
HSV
float hue = color.GetHue();
float saturation = color.GetSaturationV();
float value = color.GetValue();
HSB
float hue = color.GetHue();
float saturation = color.GetSaturationV();
float brightness = color.GetBrightness();
HSL
float hue = color.GetHue();
float saturation = color.GetSaturationL();
float lightness = color.GetLightness();
CMYK
float cyan = color.GetCyan();
float magenta = color.GetMagenta();
float yellow = color.GetYellow();
float black = color.GetBlack();
Setting Components
Sets the component values of a color.
RGBA
color.SetRed(red);
color.SetGreen(green);
color.SetBlue(blue);
color.SetAlpha(alpha);
HSV
color.SetHue(hue);
color.SetSaturationV(saturation);
color.SetValue(value);
HSB
color.SetHue(hue);
color.SetSaturationV(saturation);
color.SetBrightness(brightness);
HSL
color.SetHue(hue);
color.SetSaturationL(saturation);
color.SetLightness(lightness);
CMYK
color.SetCyan(cyan);
color.SetMagenta(magenta);
color.SetYellow(yellow);
color.SetBlack(black);
Copying Colors
Returns a copy of the color with a new component value.
RGBA
Color newColor;
newColor = color.WithRed(red);
newColor = color.WithGreen(green);
newColor = color.WithBlue(blue);
newColor = color.WithAlpha(alpha);
HSV
Color newColor;
newColor = color.WithHue(hue);
newColor = color.WithSaturationV(saturation);
newColor = color.WithValue(value);
HSB
Color newColor;
newColor = color.WithHue(hue);
newColor = color.WithSaturationV(saturation);
newColor = color.WithBrightness(brightness);
HSL
Color newColor;
newColor = color.WithHue(hue);
newColor = color.WithSaturationL(saturation);
newColor = color.WithLightness(lightness);
CMYK
Color newColor;
newColor = color.WithCyan(cyan);
newColor = color.WithMagenta(magenta);
newColor = color.WithYellow(yellow);
newColor = color.WithBlack(black);