--- name: pastel which: pastel description: "Use for choosing, analyzing, or converting colors, palettes, contrast, and colorblind simulation." license: MIT --- # pastel skill ## Commands Overview | Command | Purpose | | --------------------------------------- | ------------------------------------------------------------------ | | `pastel format` | Convert color to hex, RGB, HSL, LAB, LCH, OKLCh, ANSI, CMYK, name… | | `pastel color` | Show detailed info about a color | | `pastel textcolor` | Get a readable foreground color for a given background | | `pastel paint` | Print colored text with ANSI escape sequences | | `pastel pick` | Interactively pick a color from the screen (pipette) | | `pastel random` | Generate random colors with strategies (vivid, gray, lch_hue…) | | `pastel distinct` | Generate a set of visually distinct colors | | `pastel gradient` | Generate interpolating color sequences | | `pastel mix` | Mix two colors (configurable colorspace) | | `pastel lighten` / `pastel darken` | Adjust lightness | | `pastel saturate` / `pastel desaturate` | Adjust saturation | | `pastel rotate` | Rotate hue by an angle | | `pastel set` | Set a specific property (lightness, hue, chroma…) | | `pastel complement` | Get the complementary color (hue +180°) | | `pastel to-gray` | Fully desaturate while preserving luminance | | `pastel sort-by` | Sort colors by hue, brightness, luminance, chroma… | | `pastel colorblind` | Simulate protanopia/deuteranopia/tritanopia | | `pastel list` | Show all named CSS/X11 colors | ## Color Input Formats All commands accept colors in these formats — use whatever is most convenient: ```text #ff6b6b hex (3 or 6 digits, optional #) ff6b6b hex without # rgb(255,107,107) 255,107,107 rgb without parentheses hsl(0,100%,71%) orchid CSS/X11 color name gray(0.5) gray tone pick launch interactive color picker - read from stdin (one color per line) ``` Alpha transparency: `#rrggbbaa`, `rgba(255,107,107,0.5)`, `hsla(0,100%,71%,50%)` ## Format Conversion ```bash # Default output is hex pastel format ff6b6b # #ff6b6b # Many output formats available pastel format rgb ff6b6b # rgb(255,107,107) pastel format hsl ff6b6b # hsl(0,100%,71%) pastel format lch ff6b6b # lch(62.78,107.56,28.65) pastel format oklch ff6b6b # oklch(0.65 0.19 27.57) pastel format lab ff6b6b # lab(62.78 47.07 -9.17) pastel format name ff6b6b # salmon2 (nearest named color) pastel format cmyk ff6b6b # cmyk(0,58,58,0) pastel format luminance ff6b6b # 0.36 pastel format brightness ff6b6b # 0.67 pastel format ansi-8bit ff6b6b # 204 pastel format ansi-24bit ff6b6b # 38;2;255;107;107 ``` ## Analysis ```bash # Show full color info pastel color ff6b6b # Get readable foreground for a background pastel textcolor ff6b6b # prints a color pastel paint "$(pastel textcolor ff6b6b)" --on ff6b6b "readable text" # Check terminal 24-bit color support pastel colorcheck ``` ## Generation ```bash # Random vivid colors pastel random -n 5 # Random with specific strategy pastel random -n 5 --strategy gray # grayscale pastel random -n 5 --strategy lch_hue # fixed lightness/chroma, random hue # Visually distinct palette (maximizes perceived difference) pastel distinct 8 # 8 distinct colors pastel distinct 5 --metric CIEDE2000 # more accurate metric (slower) # Color gradient between two or more colors pastel gradient ff6b6b ffd93d -n 10 # 10 steps from red to yellow pastel gradient 555ee4 white d84341 -n 15 # multi-stop gradient pastel gradient --colorspace=HSL ffffcc fd8d3c # force colorspace ``` ## Manipulation ```bash # Lightness / Darkness pastel lighten 0.2 ff6b6b # lighten by 0.2 pastel darken 0.3 ff6b6b # darken by 0.3 # Saturation pastel saturate 0.2 ff6b6b # increase saturation pastel desaturate 0.5 ff6b6b # decrease saturation # Hue rotation pastel rotate 90 ff6b6b # rotate hue 90° clockwise pastel rotate -30 ff6b6b # rotate hue 30° counter-clockwise # Mix two colors (default: 50/50 in Lab space) pastel mix ff6b6b 4ecdc4 # 50% mix pastel mix ff6b6b 4ecdc4 -f 0.75 # 75% first color, 25% second pastel mix --colorspace=RGB red blue # mix in RGB (less perceptually uniform) # Set a specific property pastel set lightness 0.9 ff6b6b # set lightness to 0.9 pastel set hue 180 ff6b6b # set hue to 180° pastel set chroma 50 ff6b6b # set chroma to 50 # Complementary color pastel complement ff6b6b # hue + 180° # Grayscale (preserves luminance) pastel to-gray ff6b6b ``` ## Sorting ```bash pastel random -n 10 | pastel sort-by hue # sort by hue pastel random -n 10 | pastel sort-by luminance # sort by perceptual lightness pastel random -n 10 | pastel sort-by brightness # sort by relative brightness pastel random -n 10 | pastel sort-by chroma # sort by color intensity pastel random -n 10 | pastel sort-by random # shuffle pastel random -n 10 | pastel sort-by hue --reverse ``` ## Colorblind Simulation ```bash pastel colorblind prot ff6b6b # protanopia (red-blind) pastel colorblind deuter ff6b6b # deuteranopia (green-blind) pastel colorblind trit ff6b6b # tritanopia (blue-blind) # Check if a palette is distinguishable for colorblind users pastel distinct 5 | pastel colorblind deuter ``` ## Terminal Color Output ```bash # Paint text in color pastel paint ff6b6b "Hello World" pastel paint -n black --on ff6b6b --bold "ERROR" # no newline, bold, on background # ANSI escape codes for scripts pastel format ansi-24bit-escapecode ff6b6b # outputs: \e[38;2;255;107;107m pastel format ansi-8bit-escapecode ff6b6b # outputs: \e[38;5;204m # Interactive color picker pastel pick ``` ## Piping Patterns (Key Feature) `pastel` is designed for composition — chain commands together: ```bash # Generate, transform, and format in one pipeline pastel random -n 8 | pastel lighten 0.2 | pastel format hex # Create a custom mix then check it pastel color ff6b6b | pastel mix - 4ecdc4 -f 0.3 | pastel format hex # Distinct palette -> rotate each hue by 30° pastel distinct 6 | pastel rotate 30 | pastel format hex # Gradient then pick a color in the middle pastel gradient ff6b6b 4ecdc4 -n 10 | pastel format hex # Sort palette by hue then output names pastel distinct 5 | pastel sort-by hue | pastel format name # Check colorblind accessibility of a palette pastel distinct 8 | pastel colorblind deuter ``` ## Colorspace Guide `pastel` supports: `Lab`, `LCh`, `RGB`, `HSL`, `OkLab`. Choose the right one: | Colorspace | Best for | | -------------------------------- | ------------------------------------------------------- | | `Lab` (default for mix/gradient) | Perceptually uniform mixing — colors "look right" | | `LCh` | Same as Lab but in polar form (hue + chroma) | | `OkLab` | Modern perceptually uniform space, better for gradients | | `RGB` | Bright/screen colors, less perceptually accurate | | `HSL` | Wheel-based hue interpolation, can produce muddy mids | ```bash pastel mix --colorspace=Lab red blue # perceptually correct (default) pastel mix --colorspace=OkLab red blue # modern alternative pastel mix --colorspace=RGB red blue # technical but less natural pastel gradient --colorspace=OkLab c44d58 ffd93d -n 10 ``` See `references/color-theory.md` for deeper explanation of when to use each. ## Common Recipes ```bash # Find readable text color for any background fg=$(pastel textcolor ff6b6b) pastel paint "$fg" --on ff6b6b "readable" # Generate N hex codes for a palette pastel distinct 5 | pastel format hex # Create a warm-to-cool gradient pastel gradient "hsl(20,100%,70%)" "hsl(200,100%,70%)" -n 8 | pastel format hex # Desaturate a color to gray preserving luminance pastel to-gray ff6b6b | pastel format hex # Rotate a palette's hue uniformly pastel distinct 5 | pastel rotate 45 | pastel format hex # Make error/warning/info styled output pastel paint -n black --on ff6b6b --bold " ERROR " pastel paint -n black --on ffd93d --bold " WARNING " pastel paint -n black --on 4ecdc4 " INFO " ``` ## Installation If `pastel` is not installed: - macOS: `brew install pastel` - Linux (Debian): `sudo apt install pastel` or download .deb from releases - Arch: `sudo pacman -S pastel` - Nix: `nix-env --install pastel` - Via Rust: `cargo install pastel` - Windows: `scoop install pastel` or `winget install sharkdp.pastel` Check: `pastel --version`