public static List <Colour> getTwoComplementaryColours(Colour colour, double angle) { HSL hsl = colour.getHSL(); double hVal = hsl.H + angle; hVal = hVal >= 360 ? hVal - 360 : hVal; HSL positiveHSL = new HSL() { H = hVal, S = hsl.S, L = hsl.L }; double hVal1 = hsl.H - angle; hVal1 = hVal1 <= 0 ? hVal1 + 360 : hVal1; HSL negativeHSL = new HSL() { H = hVal1, S = hsl.S, L = hsl.L }; Colour c0 = Colour.HslToRgb(positiveHSL); Colour c1 = Colour.HslToRgb(negativeHSL); return(new List <Colour>() { c0, c1 }); }
public Colour(double hue, double saturation, int brightness) { Colour colour = Colour.HslToRgb(new HSL { H = hue, S = saturation, L = brightness }); A = colour.A; R = colour.R; G = colour.G; B = colour.B; Name = colour.Name; Hsl = colour.Hsl; }
/// <summary> /// http://www.easyrgb.com/index.php?X=WEEL /// Monochromatic /// Colors from the same family on the wheel. This will include lighter, darker and differently saturated versions of the color. /// </summary> /// <param name="colour"></param> /// <returns></returns> public static Colour getMonochromatic(Colour colour, double brightness) { HSL hsl = colour.getHSL(); double lVal = hsl.L + brightness; lVal = (lVal > 1 ? 1 : (lVal < 0 ? 0 : lVal)); HSL newHSL = new HSL() { H = hsl.H, S = hsl.S, L = lVal }; return(Colour.HslToRgb(newHSL)); }
/// <summary> /// http://www.easyrgb.com/index.php?X=WEEL /// Complement /// This is the color opposite on the color wheel. /// H° + 180° /// </summary> /// <param name="colour"></param> /// <returns></returns> public static Colour getComplement(Colour colour, double angle) { HSL hsl = colour.getHSL(); double hVal = hsl.H + angle; hVal = hVal >= 360 ? hVal - 360 : hVal; HSL positiveHSL = new HSL() { H = hVal, S = hsl.S, L = hsl.L }; return(Colour.HslToRgb(positiveHSL)); }