CSS colours can be lots of things:

css_colour_to_hex(x)

Arguments

x

CSS colour

Value

hex colour (always with alpha channel)

Details

  • Hex colour with 3, 6 or 8 characters

  • CSS colour name e.g. 'red'. Not all CSS colours correspond to R colours e.g. 'silver' is not in R

  • rgb(), hsl(), hcl(), lab() and other colourspace-specific colour constructores. Only rgb and hsl are currently handled

  • color() for complex colourspace specifidation. Not handled yet

  • 'transparent' and sometimes 'none' to indicate '#00000000'

  • 'currentColor' or 'currentcolor' to indicate the colour for this element should be taken from whatever the current 'color' property is

  • for SVG, colours colours can be references to 'linearGradient' and 'radialGradient' specifications, or patterns

Ref: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#currentcolor_keyword