Skip to Content
API ReferenceRoutingGradientRouteLine

GradientRouteLine

class GradientRouteLine(colors: List<String> = listOf("#eff542", "#d9682B"), positions: List<Float>? = getDefaultPositionsForColors(colors.size), lineWith: Float = 10.0f) : RouteLineStyle

Gradient line style that transitions smoothly between two or more colors along the route.

Uses MapLibre’s lineGradient expression with lineProgress interpolation to create a color gradient effect from the start to the end of the route geometry.

See also

RouteLineStyle
RoutePainterStyled

Constructors

GradientRouteLineconstructor(colors: List <String > = listOf(“#eff542”, “#d9682B”), positions: List <Float >? = getDefaultPositionsForColors(colors.size), lineWith: Float  = 10.0f)

Functions

builtLayer

open override fun builtLayer(layerId: String, sourceId: String): LineLayer

Builds a MapLibre LineLayer configured with this style’s visual properties.

lineColor

open fun lineColor(): String?

Returns the dominant line color hex (e.g. “#7000FF”), or null if not applicable.

Last updated on