Use setPaintProperty to change a layer’s fill color.
setPaintProperty
Use the interpolate expression to ease-in the building layer and smoothly fade from one color to the next.
Create a visualization with a data expression for line-color.
This example shows how to create a custom color ramp and use it to visualize a point layer.
This example shows how to add a point layer colored and sized according to the property "mag" (= earthquake magnitude) to the map using the point layer helper.