sharkdp/pastel

Rust
macOSWindowsLinux

A command-line tool to generate, analyze, convert and manipulate colors

command-linetoolterminalclicolorscolor-spacecolor-converterrust
Star 增长趋势
Star
6.5k
Forks
131
周增长
+3
Issues
26
2k4k6k
2019年8月2021年12月2024年4月2026年9月
制品库crates.io
README

pastel

Build Status

pastel is a command-line tool to generate, analyze, convert and manipulate colors. It supports many different color formats and color spaces like RGB (sRGB), HSL, CIELAB, CIELCh as well as ANSI 8-bit and 24-bit representations.

In action

pastel in action

Tutorial

Getting help

pastel provides a number of commands like saturate, mix or paint. To see a complete list, you can simply run

pastel

To get more information about a specific subcommand (say mix), you can call pastel mix -h or pastel help mix.

Composition

Many pastel commands can be composed by piping the output of one command to another, for example:

pastel random | pastel mix red | pastel lighten 0.2 | pastel format hex

Specifying colors

Colors can be specified in many different formats:

lightslategray
'#778899'
778899
789
'rgb(119, 136, 153)'
'119,136,153'
'hsl(210, 14.3%, 53.3%)'

Colors can be passed as positional arguments, for example:

pastel lighten 0.2 orchid orange lawngreen

They can also be read from standard input. So this is equivalent:

printf "%s\n" orchid orange lawngreen | pastel lighten 0.2

You can also explicitly specify which colors you want to read from the input. For example, this mixes red (which is read from STDIN) with blue (which is passed on the command line):

pastel color red | pastel mix - blue

Use cases and demo

Converting colors from one format to another

pastel format hsl ff8000

Show and analyze colors on the terminal

pastel color "rgb(255,50,127)"

pastel color 556270 4ecdc4 c7f484 ff6b6b c44d58

Pick a color from somewhere on the screen

pastel pick

Generate a set of N visually distinct colors

pastel distinct 8

Get a list of all X11 / CSS color names

pastel list

Name a given color

pastel format name 44cc11

Print colorized text from a shell script

bg="hotpink"
fg="$(pastel textcolor "$bg")"

pastel paint "$fg" --on "$bg" "well readable text"
pastel paint -n black --on red --bold "   ERROR!   "
echo " A serious error"

pastel paint -n black --on yellow --bold "  WARNING!  "
echo " A warning message"

pastel paint -n black --on limegreen --bold "    INFO    "
echo -n " Informational message with a "
echo -n "highlighted" | pastel paint -n default --underline
echo " word"

Installation

On Debian-based systems

You can download the latest Debian package from the release page and install it via dpkg:

wget "https://github.com/sharkdp/pastel/releases/download/v0.12.0/pastel_0.12.0_amd64.deb"
sudo dpkg -i pastel_0.12.0_amd64.deb

Alternatively, pastel is available in the official Debian repositories (currently in testing and unstable):

sudo apt update
sudo apt install pastel

On Arch Linux

You can install pastel from the Extra repositories:

sudo pacman -S pastel

On Nix

You can install pastel from the Nix package:

nix-env --install pastel

On MacOS

You can install pastel via Homebrew

brew install pastel

On Windows

You can install pastel via Scoop

scoop install pastel

With Winget

You can install pastel via Winget:

winget install sharkdp.pastel

Via snap package

Get it from the Snap Store:

sudo snap install pastel

On NetBSD

Using the package manager:

pkgin install pastel

From source:

cd /usr/pkgsrc/graphics/pastel
make install

On other distributions

Check out the release page for binary builds.

Via cargo (source)

If you do not have cargo, install using rust's installation documentation.

If you have Rust 1.83 or higher, you can install pastel from source via cargo:

cargo install pastel

Alternatively, you can install pastel directly from this repository by using

git clone https://github.com/sharkdp/pastel
cargo install --path ./pastel

Resources

Interesting Wikipedia pages:

Color names:

Maximally distinct colors:

Other articles and videos:

License

Licensed under either of

at your option.

相关仓库
nextlevelbuilder/ui-ux-pro-max-skill

An AI skill that provides design intelligence for building professional UI/UX across multiple platforms.

PythonPyPIskillMIT Licenseai-skillsantigravity
uupm.cc
126.2k13.5k
microsoft/terminal

The new Windows Terminal and the original Windows console host, all in the same place!

C++cliMIT Licenseconsoleterminal
104.8k9.6k
BurntSushi/ripgrep

ripgrep recursively searches directories for a regex pattern while respecting your gitignore

Rustcrates.iocliThe Unlicenseripgreprecursively-search
68.1k2.8k
tw93/Mole

🐹 Clean, uninstall, analyze, optimize, and monitor your Mac. Free open-source CLI, plus a native Mac app.

ShellcliGNU General Public License v3.0cleancleaner
mole.fit
66.6k2.3k
tldr-pages/tldr

Collaborative cheatsheets for console commands 📚.

MarkdowntutorialOthershellman-page
tldr.sh
63.6k5.4k
sharkdp/bat

A cat(1) clone with wings.

Rustcrates.iocliApache License 2.0command-linetool
60.4k1.6k
PowerShell/PowerShell

PowerShell for every system!

C#cliMIT Licensepowershellwindows
microsoft.com/PowerShell
55.3k8.5k
Aider-AI/aider

aider is AI pair programming in your terminal

PythonPyPIcliApache License 2.0chatgptcli
aider.chat
48.8k4.9k
spf13/cobra

A Commander for modern Go CLI interactions

GoGo ModulescliApache License 2.0cobracobra-library
cobra.dev
44.6k3.2k
sharkdp/fd

A simple, fast and user-friendly alternative to 'find'

Rustcrates.iocliApache License 2.0command-linetool
44.3k1.1k
Unitech/pm2

Node.js/Typescript/Bun Production Process Manager with a built-in Load Balancer.

JavaScriptnpmcliOtherpm2nodejs
pm2.keymetrics.io/docs/usage/quick-start/
43.3k2.7k
sxyazi/yazi

💥 Blazing fast terminal file manager written in Rust, based on async I/O.

Rustcrates.iocliMIT Licenseasyncioconcurrency
yazi-rs.github.io
42.1k1k