#318·pastel

Add "contrast" subcommand

Author: mitsauceplsCreated Jun 1, 2026Updated Jul 11, 2026

Hello!

I like this CLI and need to do some accessibility testing from time to time. So it would be really cool if this CLI could help me identify if I got my color contrasts correct according to the WCAG specifications.

I noticed that the necessary function is also already written inside the lib.rs, but is unused. So I put 1 and 1 together and created the contrast command.

I made it so that the first color is the base color and with it the following color contrasts are calculated.

E.g.: $ pastel contrast 556270 4ecdc4 c7f484 results to:

Base: #556270

#4ecdc4  3.22:1
#c7f484  4.96:1

Let me know what you think. You can find the PR here https://github.com/sharkdp/pastel/pull/317