New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add an option to force color output #11
Comments
Yeah, that's probably a good idea. I wonder if there's a global, existing environment variable for such a setting. |
Not that I know of or could find on the fast. |
Thanks for the research!. I think |
That use-case applies to |
Just occurred to me that setting |
COLORTERM=truecolor doesn't seem to force color when output isn't a tty, e.g. when piping to less. |
@jrwren Oops, you're right, of course! |
Slight improvement and just a small heads up: you can enforce colored output by setting |
For some reason, on two systems I use - duf isn't producing any native colour. Can't understand why because colours in other programs and scripts are working fine (bash, exa, midnight commander etc). I can cheat doing stuff like this:
But I don't understand why colours aren't working on some systems (both Debian based). (less -R will preseve colours by the way for anybody who is finding colour codes instead of colour output) |
@gsmitheidw Which terminal are you using? Could you please report the value of these environment variables: |
These aren't set on one system and are blank on the other:
Maybe that's the issue, although duf colours are working on other systems they're not set so I don't know. |
I've improved the color detection & output a bit and verified these settings should always work with the latest changes in duf: # Enforce RGB / 24-bit color mode
CLICOLOR_FORCE=1 COLORTERM="truecolor" duf
# Enforce 8-bit / 256 color mode
CLICOLOR_FORCE=1 COLORTERM="yes" duf Color output is however still limited to basic ANSI colors when printing to something other than a tty. I'll close this issue as I think this is probably a good enough solution. Disagree? Let me know! 😃 |
Seems to work now after enforcing the 2 env vars. But from a pure technical aspect, I still wonder my liquidprompt, fd, bat & other tools don't have a problem without those vars at all and behave the same as if they weren't in a shell opened via ssh will duf thinks the terminal doesn't support colors. Both Term windows are still have |
@bionade24 Thanks for the feedback! I've just created a PR on That means you won't have to set these env vars anymore in a future |
Could this be documented in |
When I pipe duf into less I want to preserve colors. Currently there is no option for that. Could an option like
--color
or--color=always
be added?The text was updated successfully, but these errors were encountered: