Adjustment

Adjusting color values is one of the most commonly used features included in the Color Pro package. Functions for adjusting colors are defined as extension methods in the static class Adjustment. To change the values of individual components, see the Components manual.


Hue Shift

Color shift = color.HueShifted(30f); // 30° shift
color.HueShift(30f); // change existing color

Color[] hues = color.Hues(30f); // 30° shift = 12 colors (360/30=12)
Color[] hues = color.Hues(12); // 12 colors = 30° shift (360/12=30)

color.HuesNonAlloc(outputArray); // prevent heap allocations

Saturate

Color saturated = color.Saturated(0.1f); // 10% increase
color.Saturate(0.1f); // change existing color

Color[] saturated = color.Saturated(10); // generate 10 saturated colors
color.SaturatedNonAlloc(outputArray); // prevent heap allocations

Desaturate

Color desaturated = color.Desaturated(0.1f); // 10% decrease
color.Desaturate(0.1f); // change existing color

Color[] desaturated = color.Desaturated(10); // generate 10 desaturated colors
color.DesaturatedNonAlloc(outputArray); // prevent heap allocations

Grayscale

Color grayscaled = color.Grayscaled();
color.Grayscale(); // change existing color

Lighter

Color lighter = color.Lighter(0.1f); // 10% increase
color.Lighten(0.1f); // change existing color

Color[] lighter = color.Lighter(10); // generate 10 lighter colors
color.LighterNonAlloc(outputArray); // prevent heap allocations

Darker

Color darker = color.Darker(0.1f); // 10% decrease
color.Darken(0.1f); // change existing color

Color[] darker = color.Darker(10); // generate 10 darker colors
color.DarkerNonAlloc(outputArray); // prevent heap allocations

Invert

Color inverted = color.Inverted();
color.Invert(); // change existing color

Complement

Color complement = color.Complement();

Websafe

Color websafe = color.Websafe();