ColorScale
deckgl_marimo.ColorScale
Map a numeric data column to interpolated colors.
Produces per-row RGBA color arrays by mapping values from a numeric
column through a color ramp. Use with any get_*_color accessor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
column
|
str
|
Name of the numeric column to map. |
required |
colors
|
list[str | list[int]] | None
|
List of 2+ colors to interpolate between. Each color can be a
CSS name ( |
None
|
palette
|
str | None
|
Name of a built-in palette. Available: |
None
|
domain
|
tuple[float, float] | None
|
|
None
|
scale
|
str
|
Scale type: |
'linear'
|
alpha
|
int
|
Alpha channel value (0-255) for all output colors. |
255
|
Examples:
>>> layer = ScatterplotLayer(
... data=df,
... get_fill_color=ColorScale("temperature", palette="viridis"),
... )
>>> layer = ScatterplotLayer(
... data=df,
... get_fill_color=ColorScale("value", colors=["blue", "red"], scale="log"),
... )
Notes
ColorScale requires materialized data. If the layer's data
is a URL string, :meth:resolve raises ValueError — load the
URL into a DataFrame or list of dicts first, or pre-compute colors
and pass them as a regular column.
resolve
Resolve to per-row RGBA arrays for JSON transfer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
Layer data (DataFrame, list of dicts, GeoJSON dict, etc.) |
required |
Returns:
| Type | Description |
|---|---|
list[list[int]]
|
Per-row |