parseColor

parseColor(color: any, alpha = 1, outputHex = false): string

This method will attempt to convert colours into their Hex or RGB equivalent . Eg "Red" will become "#FF0000"

The method accepts the following argument

color: string

The verbose color or Hex or RGB

alpha: number (defaults to 1)

The alpha value for the color

outputHex: boolean (defaults to false)

Do you want the return to be Hex (true) or RGBA (false)

Returns a Hex or RGBA string of the new colour

Last updated

Was this helpful?