ImageMagick.HexColor.Parse C# (CSharp) Method

Parse() public static method

public static Parse ( string value ) : List
value string
return List
    public static List<QuantumType> Parse(string value)
    {
      if (value.Length < 13)
        return new List<QuantumType>(ParseQ8(value));

      return new List<QuantumType>(ParseQ16(value));
    }
  }

Usage Example

Example #1
0
        private static MagickColor CreateColor(string color)
        {
            Throw.IfNullOrEmpty(nameof(color), color);

            if (color[0] == '#')
            {
                List <QuantumType> colors = HexColor.Parse(color);

                if (colors.Count == 4)
                {
                    return(new MagickColor(colors[0], colors[1], colors[2], colors[3], Quantum.Max));
                }
            }

            throw new ArgumentException("Invalid color specified", nameof(color));
        }
All Usage Examples Of ImageMagick.HexColor::Parse