Closed tlambert03 closed 1 year ago
Patch coverage: 93.75%
and project coverage change: +0.83%
:tada:
Comparison is base (
6993c88
) 86.50% compared to head (c39bceb
) 87.33%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
At first, looks nice. But it may be nice to allow exactly a specific set of colormap to select. Not one is predefined, and support colormaps are not defined in any set. (see https://github.com/napari/napari/pull/6102).
But it may be nice to allow exactly a specific set of colormap to select. Not one is predefined, and support colormaps are not defined in any set. (see https://github.com/napari/napari/pull/6102).
it can already be added to the combobox, but it looks like the line edit itself is looking for a known name, I'll fix that:
note, you can add anything that is a recognized "colormap-like" object: https://cmap-docs.readthedocs.io/en/latest/colormaps/#colormaplike-objects
so it's extremely flexible
ok, fixed... and if you wanted to give the new colormap a custom name, you can do so by passing a cmap.Colormap object:
and also, @Czaki ... if you're not familiar with cmap and it's goals, you can easily cast to any third part colormap (including napari):
from cmap import Colormap
from qtpy.QtWidgets import QApplication
from superqt import QColormapComboBox
app = QApplication([])
wdg = QColormapComboBox()
wdg.addColormaps([("#f0F", "#fdff00fF"), Colormap(("#230777",), name='MyMap')])
wdg.show()
wdg.currentColormapChanged.connect(lambda cm: print(cm.to_napari()))
app.exec()
i double checked to make sure that all the styles work in napari as well:
This looks nice to me. One idea I have is an optional checkerboard background to make it more obvious where a colormap is transparent.
One idea I have is an optional checkerboard background to make it more obvious where a colormap is transparent.
I like it! lemme see what I can do
hows this @aganders3 ?
edit ... just made the default a little smaller:
That looks great! It might not look good on all backgrounds but I also wouldn't want to get too finicky with configuration so on/off is probably good. Thanks!
this is a work-in-progress PR that will add two things:
superqt.cmap.draw_colormap
: the ability to draw any cmap recognized by thecmap
library into any PaintDevice (i.e. QWidget, QPixmap, etc...)superqt.cmap.CmapCatalogComboBox
A combobox to search/pick any colormap from the cmap catalogQColormapItemDelegate
: a general purpose item delegate that can be reused in any QAbstractItemView that wants to represent a selection of colormapsQColormapLineEdit
: a line edit that shows a colormap.QColormapComboBox
: a combobox that displays a subset of cmaps (like the one in napari), and optionally lets the user pick more,(note/reminder, cmap is a minimal dependency library that implements a colormapping API that also exports to native objects for many common python libraries like matplotlib, vispy, napari, etc...)
Example combo box that gives access to the full cmap library with text completion:
https://github.com/pyapp-kit/superqt/assets/1609449/727e10d7-1d6f-4d86-9e8a-8db629bff57b
style variant that puts the colormap to the left of the text: