Script to add viridis and other colorblind-accessible
(and perceptually uniform) palettes to ChimeraX.
The default colormap for
rainbow
is set to
turbo
.
All the new colormaps
(viridis
, magma
, inferno
, plasma
,
cividis
,
turbo
)
can be used in ChimeraX wherever builtin colormaps can be specified (docs for see
palette
),
e.g. instead of ... palette cyanmaroon ...
, try ... palette viridis ...
.
Just run runscript viridis_colormaps.py
and you are off!
New color maps are added to the dictionary colors.BuiltinColormaps
with their common
name as key and colormap constructed with chimerax.core.colors.Colormap
as value.
The following functions in chimerax.std_commands.color
use
rainbow
by default (i.e. when cmap=None
, see snippet below)
and are monkey-patched with turbo
instead.
* `_set_sequential_polymer`
* `_set_sequential_chain`
* `_set_sequential_residue`
* `_set_sequential_structures`
if cmap is None:
from chimerax.core import colors
cmap = colors.BuiltinColormaps["rainbow"]
The new colormaps are added via their 256-hex colors from bokeh.palettes (not via named colors) to stay as true as possible to the original colormap specifications.