glue-jupyter icon indicating copy to clipboard operation
glue-jupyter copied to clipboard

Make a colormap selector for image viewer

Open astrofrog opened this issue 5 years ago • 4 comments

The image viewer settings currently shows icons for the color of the layer in the layer list, and a text drop-down for the colormap:

coors

There are two modes for the image viewer - using colormaps, or using one color per dataset. The colormap dropdown is only relevant for the former mode, and the color box is only relevant for the latter.

In an ideal world, the color box next to each layer in the list should change to a selector for colormaps when in colormap mode, and we wouldn't have a separate colormap dropdown lower down, otherwise it's confusing to have colors shown that have no impact.

So I think there are two main questions here:

  • How to show colormaps visually in vuetify and have a dropdown that allows them to be shown visually
  • Using that instead of the color selector when in colormap mode

For comparison, in glue Qt the layer icon is a colormap:

Screenshot from 2020-05-15 13-02-14

and we have a separate colormap selector: cmaps

@mariobuikhuizen - what do you think would be the easiest way to go about this? I could adapt the JSON serialization to encode the colormaps in a particular format if that would be helpful?

astrofrog avatar May 15 '20 12:05 astrofrog

Maybe we encode it efficiently in a (N-colormaps x 256) pixel image (base64 encoded in needed). Then we basically would stretch a 1 pixel high image to the right amount of height. So 1 image, shown N times, with a different 'offset'.

maartenbreddels avatar May 15 '20 12:05 maartenbreddels

@maartenbreddels - that would be easy to generate from the glue side, so I'm happy to do that if @mariobuikhuizen confirms it would work from the vuetify side :)

astrofrog avatar May 15 '20 13:05 astrofrog

@astrofrog that's possible :). It wouldn't even have to be an image, a list of rgb values would also be enough.

mariobuikhuizen avatar May 15 '20 14:05 mariobuikhuizen

Or a string with rgb hex values.

mariobuikhuizen avatar May 15 '20 14:05 mariobuikhuizen