chickadee » web-colors » parse-rgb-color

parse-web-color stringprocedure
parse-hex-color stringprocedure
parse-named-color stringprocedure
parse-rgb-color stringprocedure
parse-hsl-color stringprocedure

The parse-web-color procedure parses any type of color from a string. It returns an rgb, rgb%, or hsl color list depending on the input.

The other procedures can only parse certain types of colors, but are more efficient if you only need to parse those types.

  • parse-hex-color parses hex colors with 3, 4, 6, or 8 digits. It returns a rgb color list.
  • parse-named-color parses named colors, a.k.a. color keywords. It returns a rgb color list.
  • parse-rgb-color parses rgb() or rgba() colors. It returns a rgb% color list if the red/green/blue values are percentages, or a rgb color list if they are non-percentages.
  • parse-hsl-color parses hsl() or hsla() colors. It returns a hsl color list. The hue is converted to degrees.

These procedures signal an error if parsing fails.