public static ColorF WithLightness(this IColorType original, double lightness) { ColorF colorF = original.ToColorF(); colorF.GetHSL(out double hue0To1, out double saturation0To1, out _); return(ColorF.FromHSL(hue0To1, saturation0To1, lightness)); }
public static ColorF AdjustLightness(this IColorType original, double lightnessMultiplier) { ColorF colorF = original.ToColorF(); colorF.GetHSL(out double hue0To1, out double saturation0To1, out double lightness0To1); lightness0To1 *= lightnessMultiplier; return(ColorF.FromHSL(hue0To1, saturation0To1, lightness0To1)); }
public static ColorF WithLightness(this IColorType original, double lightness) { double hue0To1; double saturation0To1; double lightness0To1; ColorF colorF = original is ColorF ? (ColorF)original : original.ToColorF(); colorF.GetHSL(out hue0To1, out saturation0To1, out lightness0To1); return(ColorF.FromHSL(hue0To1, saturation0To1, lightness)); }
public static ColorF WithLightnessAdjustment(this IColorType original, double lightnessMultiplier) { double hue0To1; double saturation0To1; double lightness0To1; ColorF colorF = original is ColorF ? (ColorF)original : original.ToColorF(); colorF.GetHSL(out hue0To1, out saturation0To1, out lightness0To1); lightness0To1 *= lightnessMultiplier; return(ColorF.FromHSL(hue0To1, saturation0To1, lightness0To1)); }
public Color BlendHsl(Color b, double rationB) { double aH, aS, aL; new ColorF(this).GetHSL(out aH, out aS, out aL); double bH, bS, bL; new ColorF(b).GetHSL(out bH, out bS, out bL); return(ColorF.FromHSL( aH * (1 - rationB) + bH * rationB, aS * (1 - rationB) + bS * rationB, aL * (1 - rationB) + bL * rationB).ToColor()); }
public TriangleRenderer() { if (colors == null) { colors = new List <Color>(); var count = 20; for (int i = 0; i < count; i++) { colors.Add(ColorF.FromHSL(i / (double)count, .7, .6).ToColor()); } } BackgroundColor = Color.LightBlue; }
public static Color FromHSL(double hue0To1, double saturation0To1, double lightness0To1, double alpha = 1) { return(ColorF.FromHSL(hue0To1, saturation0To1, lightness0To1, alpha).ToColor()); }