Open elenatorro opened 5 years ago
👍 Nice idea!
If we're already going to provide options to that method, then I would for it. I found that piece of code in the examples quite obscure for the end user. We could add something like:
{
colorFormat: 'hex' /* keeping 'rgba' as default, to keep compatibility */
}
Right now we have some examples using rgba without that ugly function and I think that it can be enough, should we close this one @elenatorro ?
I'd prefer to keep it since it's not related only with the examples but in other use cases. I wouldn't close it, I'd just give it a low priority or just label it as an enhancement.
Context
When using
getLegendData
method, for instance, in a Ramp in order to assign colors to values, you get the color in RGBA format. We've discussed in the past that this is the best way to return colors. However, in almost all of the examples where we're using this method, we have the following function to convert the color from RGBA to HEX because it's easier for us when using it in the HTMLSince
getLegendData
can receive options, such as the number the label for the 'others' values, it'd be great to have another one that let you change the color format.What do you think?