/// <summary> /// Changes the intensity. /// </summary> /// <param name="color">The color.</param> /// <param name="factor">The factor.</param> /// <returns>A color with the new intensity.</returns> public static OxyColor ChangeSaturation(this OxyColor color, double factor) { var hsv = color.ToHsv(); hsv[1] *= factor; if (hsv[1] > 1.0) { hsv[1] = 1.0; } return(OxyColor.FromHsv(hsv)); }
/// <summary> /// Changes the intensity. /// </summary> /// <param name="color">The color.</param> /// <param name="factor">The factor.</param> /// <returns>A color with the new intensity.</returns> public static OxyColor ChangeIntensity(this OxyColor color, double factor) { var hsv = color.ToHsv(); hsv[2] *= factor; if (hsv[2] > 1.0) { hsv[2] = 1.0; } return(OxyColor.FromHsv(hsv)); }
/// <summary> /// Calculates the complementary color. /// </summary> /// <param name="color">The color to convert.</param> /// <returns>The complementary color.</returns> public static OxyColor Complementary(this OxyColor color) { // http://en.wikipedia.org/wiki/Complementary_Color var hsv = color.ToHsv(); double newHue = hsv[0] - 0.5; // clamp to [0,1] if (newHue < 0) { newHue += 1.0; } return(OxyColor.FromHsv(newHue, hsv[1], hsv[2])); }