Skip to main content

A Python CLI tool for creating and exporting colormaps for data visualization and mapping applications.

Project description

Palettize

🎨 A Python utility and CLI tool for generating, previewing, and exporting colormaps.

Palettize helps create colormaps for data visualization, GIS, and web mapping. It provides a simple command-line interface to:

  • Generate colormaps from a list of colors or from built-in presets.
  • Preview colormaps directly in the terminal.
  • Export colormaps to various formats suitable for different applications.
  • Customize interpolation color space, data scaling, and slicing.

Installation

uv pip install palettize

Or install from source:

git clone https://github.com/kovaca/palettize.git
cd palettize
uv pip install .

Usage

palettize --help

Key Commands

  • palettize show: Render a colormap preview in your terminal.
  • palettize create: Export a colormap to one or more file formats.
  • palettize list: List available presets or exporters.

Examples

  1. Show a built-in preset colormap:

    palettize show viridis
    
  2. Show a custom gradient made of three colors:

    palettize show --colors "midnightblue,orange,gold"
    
  3. Export the 'viridis' preset to a GDAL color ramp file: The --domain flag maps the colormap to your data's range.

    palettize create viridis --format gdal --output viridis_gdal.txt --domain 0,255
    
  4. Create a custom colormap and export it to multiple formats: Use --steps to define the number of discrete colors in the output.

    palettize create -c "blue,white,red" --format qgis,mapgl \
      --output "output/rwb_{format}.{ext}" --steps 11 --name "RedWhiteBlue"
    

    This creates output/rwb_qgis.xml and output/rwb_mapgl.json.

  5. List all available built-in presets:

    palettize list presets
    
  6. Pass format-specific options during export: Use the -O or --option flag to pass key-value pairs to an exporter.

    # Tell the 'observable' exporter to create a diverging scale with a pivot
    palettize create RdBu -f observable --domain -5,10 -o plot.json \
      -O type=diverging -O pivot=0
    

Features

  • Flexible Colormap Creation: Generate colormaps from lists of colors (hex, RGB, named) or use built-in presets.
  • Advanced Interpolation: Supports various color spaces for interpolation via the ColorAide library (e.g., Oklch, sRGB, LAB).
  • Terminal Preview: Instantly visualize any colormap in your terminal.
  • Multiple Export Formats: Supports common formats for GIS (GDAL, QGIS, SLD, Titiler) and web (MapLibre GL, Observable Plot).
  • Customizable Scaling: Apply linear, power, sqrt, or log scaling to map your data domain to the colormap.
  • Plugin System for Exporters: Easily extendable with new export formats.
  • CLI with Rich Output: User-friendly command-line interface with clear help messages and rich formatting.

Available Presets

The incredibly useful cmap library is a core dependency used for presets. To see a list of colormap presets, run: palettize list presets

Available Export Formats

To see a list of all currently registered and available export formats, run: palettize list exporters

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

palettize-0.0.1a2.tar.gz (35.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

palettize-0.0.1a2-py3-none-any.whl (41.4 kB view details)

Uploaded Python 3

File details

Details for the file palettize-0.0.1a2.tar.gz.

File metadata

  • Download URL: palettize-0.0.1a2.tar.gz
  • Upload date:
  • Size: 35.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for palettize-0.0.1a2.tar.gz
Algorithm Hash digest
SHA256 d7105e1a9c036e1ebb4ea485e6d9b253ac6a3b23c421f8e22fbeb4d76ac8cd9e
MD5 7055554c54eb709dd425da39355682da
BLAKE2b-256 90169e14c06aa4a4bec2880467d45e63c6a5906966a76958884552aa7816638c

See more details on using hashes here.

Provenance

The following attestation bundles were made for palettize-0.0.1a2.tar.gz:

Publisher: release.yml on kovaca/palettize

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file palettize-0.0.1a2-py3-none-any.whl.

File metadata

  • Download URL: palettize-0.0.1a2-py3-none-any.whl
  • Upload date:
  • Size: 41.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for palettize-0.0.1a2-py3-none-any.whl
Algorithm Hash digest
SHA256 46c47a51a41664c24cd3418944bd3901d1a74da6683f16d291132e7ef793caef
MD5 f3bf1657e3da0c590650e48c8cbcbbc7
BLAKE2b-256 8746a425e56c9cd34b8b1c6f23d06216673164a8a1d0f82e985f7ceeac3a4397

See more details on using hashes here.

Provenance

The following attestation bundles were made for palettize-0.0.1a2-py3-none-any.whl:

Publisher: release.yml on kovaca/palettize

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page