Skip to content

Hex Export Format

The Hex exporter creates simple plaintext files with hex color values, one per line.

PropertyValue
Identifierhex
Extension.txt
Use caseGeneral purpose, configuration files
#440154
#482878
#3e4989
#31688e
#26828e
#1f9e89
#35b779
#6ece58
#b5de2b
#fde725

Each line contains a 6-character hex color with # prefix.

Terminal window
# Basic export
palettize create viridis --format hex --output colors.txt
# Specific number of colors
palettize create viridis -f hex -o colors.txt --steps 10
# Print to stdout
palettize create viridis -f hex --steps 5
from palettize import create_colormap, get_scaler_by_name, get_exporter
cmap = create_colormap(preset="viridis")
scaler = get_scaler_by_name("linear", domain_min=0, domain_max=1)
exporter = get_exporter("hex")
output = exporter.export(
colormap=cmap,
scaler=scaler,
domain_min=0,
domain_max=1,
options={"num_colors": 10}
)
# Split into list
colors = output.strip().split('\n')
print(colors) # ['#440154', '#482878', ...]
OptionTypeDefaultDescription
num_colorsint256Number of colors to generate

Many applications accept color lists in configuration:

config.yaml
colors:
- "#440154"
- "#482878"
- "#3e4989"
:root {
--color-1: #440154;
--color-2: #482878;
--color-3: #3e4989;
}

Import colors into design tools:

  1. Export: palettize create viridis -f hex --steps 10
  2. Copy output
  3. Paste into Figma, Sketch, or other design tools
Terminal window
# Generate colors and use in script
colors=$(palettize create viridis -f hex --steps 5)
# Process each color
echo "$colors" | while read color; do
echo "Processing $color"
done
# Quick way to get a color list
output = exporter.export(cmap, scaler, 0, 1, {"num_colors": 5})
colors = output.strip().split('\n')
# Use with matplotlib
import matplotlib.pyplot as plt
from matplotlib.colors import LinearSegmentedColormap
cmap = LinearSegmentedColormap.from_list("custom", colors)
FeatureHexRGBA
Alpha supportNoYes
Format#RRGGBBrgba(R, G, B, A)
CSS compatibleYesYes
File sizeSmallerLarger

Use Hex when you don’t need alpha transparency. Use RGBA when you need alpha values.