sharkdp / pastel

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

Request: Add a second ordering criterium for `pastel sort` #136

Open nkh opened 3 years ago

nkh commented 3 years ago

sorting color generate a large output which makes it difficult to compare the colors to each other, the possibility to sort colors and present them in one line would be very welcome

sharkdp commented 3 years ago

You could use the -f (--force-color) mode in your last pastel call and pipe to xargs echo. For example:

pastel distinct 12 | pastel sort | pastel -f format hex | xargs echo

or:

pastel list | pastel sort-by hue | pastel -f format name | xargs echo
nkh commented 3 years ago

is there a way to sort by hue and luminosity?

sharkdp commented 3 years ago

Yes. Check out pastel sort-by --help.

nkh commented 3 years ago

I did but I see nothing there that tell me how to sort by Hue AND Brightness, trying to give both is an error and piping the first in the second doesn't sort on both criteria.

sorting on Hue gives, ie: dimgray, gainsboro, gray, lightgray

sharkdp commented 3 years ago

what does it mean to sort by "Hue AND Brightness"? Do you mean: Sort "by Hue, THEN by Brightness"? I.e.: For colors where the hue is exactly the same, sort by brightness?

nkh commented 3 years ago

an example explains better, if you look at the colors I listed in that order (given by sort-by hue) above do they look sorted to you?

sharkdp commented 3 years ago

Well. These colors all have a hue of zero:

▶ pastel format hsl-hue dimgray gainsboro gray lightgray
0
0
0
0

I agree, they don't look sorted, as the brightness goes up and down. So indeed, it would be useful to have a second (lower priority) sort order for the sort subcommand. Let's turn this into a feature request :+1: