/// <summary> /// Gets the color of the hexadecimal. /// </summary> /// <param name="ratio">The ratio: from 0 to 1</param> /// <param name="withAlpha">if set to <c>true</c> [with alpha].</param> /// <returns></returns> public String GetHexColor(Double ratio, Boolean withAlpha = true) { ColorHSVPoint output = GetHSVColor(ratio); String hex = output.GetHexColor(withAlpha); return(hex); }
/// <summary> /// Gets the hexadecimal color dictionary - where Key is color, Double is upper limit for the color segment /// </summary> /// <param name="colorSegments">The color segments.</param> /// <param name="withAlpha">if set to <c>true</c> [with alpha].</param> /// <returns></returns> public ColorGradientDictionary GetHexColorDictionary(Int32 colorSegments, Boolean withAlpha = true) { var output = new ColorGradientDictionary(); if (colorSegments < 1) { return(output); } Double c = 1.GetRatio(colorSegments); Double ci = c; //var r = PointRange.GetRangeMultiplied(c); //var head = PointA.Clone(); if (!IsReady) { Prepare(); } for (int i = 0; i < colorSegments; i++) { Double r = i.GetRatio(colorSegments); ColorHSVPoint head = GetHSVColor(r); var ci_hex = head.GetHexColor(); if (!output.ContainsKey(ci_hex)) { output.Add(ci_hex, ci); } ci = ci + c; } return(output); }
public List <String> GetColorSteps(Int32 colorSegments, Boolean withAlpha = true) { if (!IsReady) { Prepare(); } List <String> output = new List <string>(); for (int i = 0; i <= colorSegments; i++) { Double r = i.GetRatio(colorSegments); ColorHSVPoint head = GetHSVColor(r); var ci_hex = head.GetHexColor(); if (!output.Contains(ci_hex)) { output.Add(ci_hex); } } return(output); }