pub fn color_parser(input: &str) -> IResult<&str, Color>
Expand description

Parser for strings that represent a [bevy::render::color::Color].

The syntax is inspired by CSS:

  • `red, blue -> css color names (see https://drafts.csswg.org/css-color/#named-colors)
  • #f0f, #ff00ff -> hex color (3 or 6 digits)
  • #ff00ff00 -> hex color with alpha (8 digits)
  • rgb(1.0, 0.0, 0.0) -> rgb color (0.0-1.0)
  • rgba(1.0, 0.0, 0.0, 1.0) -> rgb color with alpha (0.0-1.0)
  • hsl(0.0, 1.0, 0.5) -> hsl color (0.0-1.0)
  • hsla(0.0, 1.0, 0.5, 1.0) -> hsl color with alpha (0.0-1.0)