Hex Export Format
The Hex exporter creates simple plaintext files with hex color values, one per line.
Format Details
Section titled “Format Details”| Property | Value |
|---|---|
| Identifier | hex |
| Extension | .txt |
| Use case | General purpose, configuration files |
Output Format
Section titled “Output Format”#440154#482878#3e4989#31688e#26828e#1f9e89#35b779#6ece58#b5de2b#fde725Each line contains a 6-character hex color with # prefix.
CLI Usage
Section titled “CLI Usage”# Basic exportpalettize create viridis --format hex --output colors.txt
# Specific number of colorspalettize create viridis -f hex -o colors.txt --steps 10
# Print to stdoutpalettize create viridis -f hex --steps 5Python Usage
Section titled “Python Usage”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 listcolors = output.strip().split('\n')print(colors) # ['#440154', '#482878', ...]Options
Section titled “Options”| Option | Type | Default | Description |
|---|---|---|---|
num_colors | int | 256 | Number of colors to generate |
Use Cases
Section titled “Use Cases”Configuration Files
Section titled “Configuration Files”Many applications accept color lists in configuration:
colors: - "#440154" - "#482878" - "#3e4989"CSS Custom Properties
Section titled “CSS Custom Properties”:root { --color-1: #440154; --color-2: #482878; --color-3: #3e4989;}Color Picker Integration
Section titled “Color Picker Integration”Import colors into design tools:
- Export:
palettize create viridis -f hex --steps 10 - Copy output
- Paste into Figma, Sketch, or other design tools
Shell Scripts
Section titled “Shell Scripts”# Generate colors and use in scriptcolors=$(palettize create viridis -f hex --steps 5)
# Process each colorecho "$colors" | while read color; do echo "Processing $color"donePython Lists
Section titled “Python Lists”# Quick way to get a color listoutput = exporter.export(cmap, scaler, 0, 1, {"num_colors": 5})colors = output.strip().split('\n')
# Use with matplotlibimport matplotlib.pyplot as pltfrom matplotlib.colors import LinearSegmentedColormap
cmap = LinearSegmentedColormap.from_list("custom", colors)Comparing to RGBA Format
Section titled “Comparing to RGBA Format”| Feature | Hex | RGBA |
|---|---|---|
| Alpha support | No | Yes |
| Format | #RRGGBB | rgba(R, G, B, A) |
| CSS compatible | Yes | Yes |
| File size | Smaller | Larger |
Use Hex when you don’t need alpha transparency. Use RGBA when you need alpha values.