cssColor

Attempts to convert any input value into a CSS color value (e.g. 9965381 into #980F45).
The input value can also be the name of a style color variable (e.g. primaryColor).

Syntax

$cssColor(value)

Parameter

Name

Description

value

A value to be converted to the color value.
The following formats are supported:

  • Numbers (Color as integer e.g. 9965381)

  • Hexadecimal (e.g. #980F45, 0x980F45, 980F45)

  • Style variable name (e.g. primaryColor)

Return value

The converted color value back or null if the input value could not be converted.

Hint: A corresponding contrast color, which allows writing on background colors, can be derived using the $contrastColor function.