sharkdp / pastel

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

`pastel format ansi-8bit` not working for me #111

Closed eggbean closed 4 years ago

eggbean commented 4 years ago

Nice colour tool.

I have PASTEL_COLOR_MODE=8bit set, as I appear to be using an 8-bit terminal, so I cannot properly see the whole range of the output from pastel list.

What I would like to use this for is looking for terminal colours to use in theming things like tmux. But this is not giving any output:

pastel random -n 20 | pastel format ansi-8bit
pastel color cornflowerblue | pastel format ansi-8bit

rgb format works fine.

sharkdp commented 4 years ago

Thank you for the feedback!

I guess it works, but you don't see the output, because it will output an ANSI escape code. Output something else in addition, and you should see the colors appearing:

printf "$(pastel format ansi-8bit cornflowerblue)TEST\x1b[0m\n"
printf "$(pastel random -n1 | pastel format ansi-8bit)TEST\x1b[0m\n"

If you want a nicer API, you can also take a look at the pastel paint subcommand:

pastel paint cornflowerblue TEST
pastel paint black --on cornflowerblue TEST
pastel random -n1 | pastel paint - TEST
pastel random | xargs -I{color} pastel paint {color} Test