setPaintProperty<
Kextends keyofAllPaintProperties>(layerId:string,name:K,value:AllPaintProperties[K],options?:StyleSetterOptions):this
Defined in: ui/map.ts:3704
Sets the value of a paint property in the specified style layer.
Type Parameters
| Type Parameter |
|---|
K extends keyof AllPaintProperties |
Parameters
| Parameter | Type | Description |
|---|---|---|
layerId |
string |
The ID of the layer to set the paint property in. |
name |
K |
The name of the paint property to set. |
value |
AllPaintProperties[K] |
The value of the paint property to set. Must be of a type appropriate for the property, as defined in the MapLibre Style Specification. Pass null to unset the existing value. |
options? |
StyleSetterOptions |
Options object. |
Returns
this
Example
map.setPaintProperty('my-layer', 'fill-color', '#faafee');
See
- Change a layer's color with buttons
- Create a draggable point