sharkdp / pastel

A command-line tool to generate, analyze, convert and manipulate colors
Apache License 2.0
4.98k stars 97 forks source link

Option for more compact display of multiple colors. #137

Open sullyj3 opened 3 years ago

sullyj3 commented 3 years ago

First of all, this is a fantastic project, thanks for creating it!

Often when displaying multiple colors, it's desirable to be able to compare them side by side! Unfortunately, by default the color subcommand takes up a lot of vertical space, making it difficult to compare earlier and later colors, and inserts gaps and text, distancing them.

It would be cool to have some kind of flag or subcommand to display the color squares side by side, with minimal text. I'm imagining something along the lines of

pastel color --compact < lotsOfColors.txt

or

pastel compare < lotsOfColors.txt

This feature would be particularly useful for creating color palettes and themes, both interactively and programmatically.

sharkdp commented 3 years ago

Thank you for reporting this. I agree that this would be useful.

A related feature would be https://github.com/sharkdp/pastel/issues/21. Would that also work for your use case?

sullyj3 commented 2 years ago

Partially, but #21 that still seems like its for comparing only two colors at once pairwise, rather than many. Consider the following example:

> cat 1.json
{
   "Razzmic Berry":"8a4f7d",
   "Rocket Metallic":"887880",
   "Rocket Metallic 2":"887f84",
   "Taupe Gray":"888587",
   "Battleship Grey":"888c8b",
   "Morning Blue":"88938f",
   "Morning Blue 2":"889992",
   "Morning Blue 3":"88a096",
   "Khaki Web":"bbab8b",
   "Salmon":"ef8275"
}
> jq -r 'values[]' 1.json|pastel color

The second command results in about a screen and a half of output. Whereas it would be nice to be able to compare them all at once without scrolling, perhaps as vertical stripes.

sullyj3 commented 2 years ago

Ah, I just noticed the script you demonstrated in #139, pastel paint looks like a nice solution.

for COLOR in $(jq -r 'values[]' 1.json); do pastel paint $(pastel textcolor $COLOR) --on $COLOR "$COLOR          "; done

Although it would be handy and ergonomic to have something like that built in, so as not to have to remember where I saved the script.