fromCssColorString

fun fromCssColorString(color: String, result: Color? = definedExternally): Color(source)

Creates a Color instance from a CSS color value.

const cesiumBlue = Color.fromCssColorString('#67ADDF');
const green = Color.fromCssColorString('green');

Return

The color object, or undefined if the string was not a valid CSS color.

Parameters

color

The CSS color value in #rgb, #rgba, #rrggbb, #rrggbbaa, rgb(), rgba(), hsl(), or hsla() format.

result

The object to store the result in, if undefined a new instance will be created.

See also