cssColor

Prev Next

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).

Tooltip

Syntax: $cssColor(value)

Parameter

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)

Returns the converted color value or zero if the input value could not be converted.

Examples:$cssColor(primaryColor) – Delivers by default (#980F45)$cssColor(9965381) – Delivers #980F45

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 (Calculate contrast color) function.