ScriptsMay 13, 2026·3 min read

Pastel — Command-Line Color Tool Written in Rust

A CLI tool for generating, analyzing, converting, and manipulating colors from the terminal, with support for multiple color spaces and output formats.

Introduction

Pastel is a command-line tool written in Rust for working with colors. It can parse colors from various formats, convert between color spaces, generate palettes and gradients, and display color previews directly in the terminal. It is built by the same developer behind bat, fd, and hyperfine.

What Pastel Does

  • Parses colors from hex, RGB, HSL, Lab, LCH, and CSS color name formats
  • Converts colors between different color spaces with perceptually accurate transforms
  • Generates complementary, triadic, tetradic, and analogous color schemes
  • Creates smooth gradients between two or more colors with configurable steps
  • Displays terminal color swatches for visual inspection directly in the shell

Architecture Overview

Pastel is a single Rust binary with no runtime dependencies. It uses the CIELAB color space internally for perceptually uniform operations like mixing and gradient generation. Input parsing handles multiple formats and normalizes them to an internal representation. Output formatting supports hex, RGB tuples, HSL, and ANSI escape codes. The CLI uses clap for argument parsing with subcommand-based ergonomics.

Self-Hosting & Configuration

  • Install via cargo install, Homebrew, apt, pacman, or download prebuilt binaries from GitHub releases
  • Pipe pastel output into other tools using --format hex, rgb, or hsl for scriptable workflows
  • Use the colorcheck subcommand to simulate color-blind vision for accessibility testing
  • Combine with shell scripts to batch-process color lists from files or stdin
  • Works in any terminal that supports true color (24-bit) for accurate swatch display

Key Features

  • Perceptually uniform color mixing using CIELAB rather than naive RGB interpolation
  • Color blindness simulation (protanopia, deuteranopia, tritanopia) for accessibility checks
  • Lighten, darken, saturate, and desaturate commands with percentage-based adjustments
  • Sort colors by hue, saturation, lightness, or luminance for palette organization
  • Distinct color generation produces maximally distinguishable colors for data visualization

Comparison with Similar Tools

  • color-convert (npm) — JavaScript library for programmatic conversion, not a CLI tool
  • colordiff — highlights differences in text output, not a general-purpose color tool
  • gpick — GUI color picker for desktop environments, not terminal-based
  • tcolor — simpler terminal color display tool without palette generation or color space conversion

FAQ

Q: Does Pastel work on Windows? A: Yes. It runs on Windows, macOS, and Linux. Color swatch display requires a terminal with true color support.

Q: Can I use Pastel in shell scripts? A: Yes. Use the --format flag to get machine-readable output (hex, rgb-float, hsl) for piping into other commands.

Q: What color spaces does Pastel support? A: It handles RGB, HSL, CIELAB, CIELCh, hex, and CSS named colors. Internal operations use CIELAB for perceptual accuracy.

Q: Who created Pastel? A: David Peter (sharkdp), the same developer behind bat, fd, and hyperfine.

Sources

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets