erlab.interactive.colors¶
Functions for manipulating colors in Qt.
Functions
|
Convert a matplotlib color to a |
Check if the system is in dark mode. |
|
|
Get a |
|
Get all valid pyqtgraph colormap names. |
|
|
|
Convert a |
Classes
|
|
|
|
|
Dialog for selecting a color cycle. |
|
|
|
Slider and spinbox for adjusting colormap gamma. |
- class erlab.interactive.colors.BetterColorBarItem(parent=None, image=None, autoLevels=False, limits=None, pen='c', hoverPen='m', hoverBrush='#FFFFFF33', *, show_colormap_edit_menu=True, **kargs)[source]¶
Bases:
PlotItem- property images¶
- property primary_image¶
- class erlab.interactive.colors.BetterImageItem(image=None, **kwargs)[source]¶
Bases:
ImageItempyqtgraph.ImageItemwith improved colormap support.- Parameters:
- Signals:
sigColorChanged()
sigLimitChanged(float, float)
- class erlab.interactive.colors.ColorCycleDialog(colors, *, parent=None, preview_cursors=False, opacity_values=(0.95, 0.75, 0.15, 0.35), default_colors=None)[source]¶
Bases:
QDialogDialog for selecting a color cycle.
This dialog takes a list of colors and allows the user to edit each color in the cycle, or overwrite the entire cycle by sampling from a colormap.
- Parameters:
colors (
Iterable[QColor]) – An iterable of colors to use as the initial color cycle.parent (
QWidget|None, default:None) – The parent widget for the dialog.preview_cursors (
bool, default:False) – IfTrue, the preview will include cursor lines and spans with the selected colors.opacity_values (
tuple[float,float,float,float], default:(0.95, 0.75, 0.15, 0.35)) – A tuple of four float values representing the opacity for the cursor line, cursor line hover, span background, and span edge, respectively. Each value should be between 0 and 1, where 1 is fully opaque and 0 is fully transparent.default_colors (
Iterable[QColor] |None, default:None) – An iterable of default colors to return to when the user clicks “Restore Defaults”. IfNone, the restore defaults button will not be shown.
- class erlab.interactive.colors.ColorMapGammaWidget(parent=None, value=1.0, slider_cls=None, spin_cls=None)[source]¶
Bases:
QWidgetSlider and spinbox for adjusting colormap gamma.
- Signals:
valueChanged(float)
- erlab.interactive.colors.color_to_QColor(c, alpha=None)[source]¶
Convert a matplotlib color to a
PySide6.QtGui.QColor.- Parameters:
c (
tuple[float,float,float] |str|tuple[float,float,float,float] |tuple[tuple[float,float,float] |str,float] |tuple[tuple[float,float,float,float],float]) – A valid matplotlib color. See the matplotlib documentation for more information.alpha (
float|None, default:None) – If supplied, applies transparency to the color.
- Returns:
- Return type:
- erlab.interactive.colors.is_dark_mode()[source]¶
Check if the system is in dark mode.
If a QApplication is not running, this will always return False.
- erlab.interactive.colors.pg_colormap_from_name(name, skipCache=True)[source]¶
Get a
pyqtgraph.ColorMapfrom its name.- Parameters:
name (
str) – A valid colormap name.skipCache (
bool, default:True) – Whether to skip cache, by defaultTrue. Passed ontopyqtgraph.colormap.get().
- Returns:
- Return type:
- erlab.interactive.colors.pg_colormap_names(source='all', exclude_local=False)[source]¶
Get all valid pyqtgraph colormap names.
- erlab.interactive.colors.pg_colormap_powernorm(cmap, gamma, reverse=False, high_contrast=False, zero_centered=False, N=65536)[source]¶
- erlab.interactive.colors.pg_colormap_to_QPixmap(cmap, w=64, h=16, skipCache=True)[source]¶
Convert a
pyqtgraph.ColorMapto aw-by-hQPixmap thumbnail.- Parameters:
- Returns:
- Return type: