You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Users who want to use the function method on the style spec package sometimes need to parse colors too (see https://www.mapbox.com/mapbox-gl-js/example/data-join/). We could make their workflow easier and more consistent by exposing our implementation of parseColor on the style spec package.
Just exposing this method will probably lead to some unexpected, since it uses a cache. Modifying the output will modify future output for the same input.
parseColor is a pretty thin wrapper around csscolorparser - could we recommend instead that implementors use that module?
@tmcw good catch. Would changing it to return a deep copy of the value from the cache be a bad idea? Do we have a benchmark set up to test the performance impact of a copy? If that isn't a good route, looks like csscolorparser would do most of what we need (save for the counterintuitive math where each RGB component needs to be multiplied by alpha).
Users who want to use the
function
method on the style spec package sometimes need to parse colors too (see https://www.mapbox.com/mapbox-gl-js/example/data-join/). We could make their workflow easier and more consistent by exposing our implementation ofparseColor
on the style spec package.cc @kronick @ryanbaumann
The text was updated successfully, but these errors were encountered: