I'm trying to dynamically set the fill colour for a GeoJSON layer based on its properties. The properties for the feature would be:
properties: {
color: 'cyan',
colorSelected: 'magenta',
selected: false,
}
For the mapbox paint attribute, I have:
paint: {
"fill-color": [
'case',
['==', ['get', 'selected'], ['get', 'colorSelected']],
['get', 'color'],
]
}
The idea being that if the "selected" property is true, get colourSelected = 'magenta', else the default of 'cyan'
This is not working, how can I do this boolean selection?