sharkdp / pastel

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

how to force colour output with a pager ? #219

Open simonmichael opened 6 months ago

simonmichael commented 6 months ago

I love pastel, thanks!

Output is often long and I'd like to view it in a pager. I think pastel disables colour output when stdout is non-interactive. How can I force it not to ? I tried eg TERM=xterm-256color COLOR=always pastel -f list | less -R

sharkdp commented 5 months ago

Oh, that is a bug.

-f should indeed force colors to be visible, even if the output is non-interactive. I'm pretty sure this worked before...

sharkdp commented 5 months ago

Or maybe it only worked for pastel paint (where -f still works)

andelink commented 3 months ago

FWIW I also have not been able to get the pastel color command to force colorization. pastel paint yes, pastel color and pastel list, no. I would also really appreciate this feature if it's possible

jessefarinacci commented 3 weeks ago

I'm interested in this too, and I also love pastel! I wanted to use pastel as part of a color theme picker TUI. :) If you have fzf installed, here's a quick working demo of the same non-interactive mode not allowing the full typical output.

pastel random | pastel format | fzf --preview 'pastel color {}'

I also tried with pastel --color-mode 24bit --force-color color {} in the final preview step, no joy. Confirmed works with pastel paint {} 'quick brown fox lazy dog'