cds-astro / aladin-lite

An astronomical HiPS visualizer in the browser
https://aladin.cds.unistra.fr/AladinLite/
GNU General Public License v3.0
103 stars 42 forks source link

Not possible to display custom color map #174

Closed pmatsson closed 3 months ago

pmatsson commented 4 months ago

Hi,

Creating a custom color map works great through the WASM API:

https://github.com/cds-astro/aladin-lite/blob/7da91d72934f41f99d5116e062cc3d121d0f3d66/src/core/src/lib.rs#L895

However, displaying the custom color map isn't possible due to this check:

https://github.com/cds-astro/aladin-lite/blob/7da91d72934f41f99d5116e062cc3d121d0f3d66/src/js/ColorCfg.js#L174-L180

Would it be possible to have a "single source of truth" for available color maps, rather than relying on the fixed list in JS?

bmatthieu3 commented 3 months ago

Hi @pmatsson - this commit should fix it and allow you to add new colormaps:

aladin.addColormap('label', ['purple', 'lightgreen', '0x45aaffff', 'rgba(10, 255, 20, 255)'])

There is also a method to get all the labels

aladin.getListOfColormaps()