/// <summary> /// Returns this colour, but with a specific saturation level. /// </summary> /// <param name="saturation">The saturation of the colour (normalized)</param> /// <returns>The new colour</returns> public static Color WithSaturation(this Color c, float saturation) { HSVColour hsv = new HSVColour(c); hsv.S = saturation; return(hsv.ToRGB()); }
/// <summary> /// Returns this colour, but with a specific brightness. /// </summary> /// <param name="value">The value of the colour (normalized)</param> /// <returns>The new colour</returns> public static Color WithValue(this Color c, float value) { HSVColour hsv = new HSVColour(c); hsv.V = value; return(hsv.ToRGB()); }
/// <summary> /// Returns this colour, but with a different hue. /// </summary> /// <param name="hue">The value of the tone (normalized)</param> /// <returns>The new colour</returns> public static Color WithHue(this Color c, float hue) { HSVColour hsv = new HSVColour(c); hsv.H = hue; return(hsv.ToRGB()); }
/// <summary> /// Returns this colour, but with the brightness shifted by a certain amount. /// </summary> /// <param name="valueShiftAmount">The amount to value shift (normalized)</param> /// <returns>The new value shifted colour</returns> public static Color WithValueShift(this Color c, float valueShiftAmount) { HSVColour hsv = new HSVColour(c); hsv.V += valueShiftAmount; return(hsv.ToRGB()); }
/// <summary> /// Returns this colour, but the saturation shifted by a certain amount. /// </summary> /// <param name="saturationShiftAmount">The amount to saturation shift (normalized)</param> /// <returns>The new saturation shifted colour</returns> public static Color WithSaturationShift(this Color c, float saturationShiftAmount) { HSVColour hsv = new HSVColour(c); hsv.S += saturationShiftAmount; return(hsv.ToRGB()); }
/// <summary> /// Returns this colour, but hue shifted by a certain amount. /// </summary> /// <param name="hueShiftAmount">The amount to hue shift (normalized)</param> /// <returns>The new hue shifted colour</returns> public static Color WithHueShift(this Color c, float hueShiftAmount) { HSVColour hsv = new HSVColour(c); hsv.H += hueShiftAmount; return(hsv.ToRGB()); }
/// <summary> /// Returns this colour, but shifted on any of the hue, saturation or value axes. /// </summary> /// <param name="hueShiftAmount">The amount to hue shift (normalized)</param> /// <param name="saturationShiftAmount">The amount to saturation shift (normalized)</param> /// <param name="valueShiftAmount">The amount to value shift (normalized)</param> /// <returns>The new shifted colour</returns> public static Color WithHSVShift(this Color c, float hueShiftAmount, float saturationShiftAmount, float valueShiftAmount) { HSVColour hsv = new HSVColour(c); hsv.H += hueShiftAmount; hsv.S += saturationShiftAmount; hsv.V += valueShiftAmount; return(hsv.ToRGB()); }