toColor

open fun toColor(@NonNull input: Expression): Expression

Converts the input value to a color. If multiple values are provided, each one is evaluated in order until the first successful conversion is obtained. If none of the inputs can be converted, the expression is an error.

Example usage:


FillLayer fillLayer = new FillLayer("layer-id", "source-id");
fillLayer.setProperties(
    fillColor(toColor(get("keyStringValue")))
);

Return

expression

Parameters

input

expression input

See also

<a href="https://maplibre.org/maplibre-style-spec/expressions/#types-to-color">Style specification</a>