cellects.display.param
cellects.display.param
This script contains color, font, and size parameters for displaying images, videos, and plots.
generate_color_gradient(colors, n_steps)
Generate a linear color gradient interpolating between a sequence of RGB colors.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
colors
|
list
|
List of RGB tuples defining the colors to interpolate through. |
required |
n_steps
|
int
|
Total number of color tuples to generate to fill the gradient between the provided colors. |
required |
Returns:
| Type | Description |
|---|---|
list
|
A list of RGB tuples forming a gradient between the provided colors. |
Examples:
>>> colors = [(255, 0, 0), (0, 255, 0), (0, 0, 255)]
>>> gradient = generate_color_gradient(colors, 5)
>>> print(gradient)
[(255.0, 0.0, 0.0), (127.5, 127.5, 0.0), (0.0, 255.0, 0.0),
(0.0, 127.5, 127.5), (0.0, 0.0, 255.0)]
Source code in src/cellects/display/param.py
get_mpl_colormap(cmap_name)
Returns a linear color range array for the given matplotlib colormap.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cmap_name
|
str
|
The name of the colormap to get. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
A 256x1x3 array of bytes representing the linear color range. |
Examples: