pastel icon indicating copy to clipboard operation
pastel copied to clipboard

Option for more compact display of multiple colors.

Open sullyj3 opened this issue 3 years ago • 3 comments

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.

sullyj3 avatar Apr 20 '21 13:04 sullyj3

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?

sharkdp avatar May 09 '21 09:05 sharkdp

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 avatar Nov 11 '21 04:11 sullyj3

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.

sullyj3 avatar Nov 11 '21 05:11 sullyj3