Closed tkossak closed 2 years ago
Thanks for the bug report. xonsh
is actually not officially supported, but I think I can look into it
https://xon.sh/customization.html#color-my-man-pages
It would be useful if it had 'disable colors' option. Then it would work everywhere, xonsh or not. Thank you for awesome module!
I think this issue is not related to xonsh. The color is not related to shell, it's related to terminal instead, when we print something from terminal, like printf "\\x1b[93mfoo\\x1b[92mbar"
(escape code), the terminal (iTerm2) will render it to colorful text.
The config uniform-color = bright white
is not really "disable" colors, instead, it still output text with colors, just the color is white. That's why you will still see those escape codes.
Cli usually check if the current stdout is a TTY or not, if it is, cli will output with colors.
If it is not a TTY, then will output without colors(aka, without the escape code)
If you want, you can still enable color even it is not a TTY.
So I think we can do the same in pdir2:
PDIR2_NOCOLOR
is set, then disable color alwaysoutput_color = auto
which is the default setting, then pdir2 will output with colors if current stdout is a TTY, otherwise output plain text. If the config was set to output_color=True
or output_color=False
, then always follows the config.What do you think?
That would be awesome! Pdir2 could start working not only in xonsh, but also in vscode and other places that do not accept standard terminal escape sequences. Thank you.
I'll cut a new release this weekend
In 0.3.6 you can disable color, see https://github.com/laike9m/pdir2/wiki/User-Configuration#disable-color
Let me know if you encounter any issues.
Hello, i tried disabling coloring wiith config file:
but pdir still prints color characters in xonsh eg, when I run
pdir(__xonsh__.history)
lines look like:How to get rid of these characters? Either disable coloring or make them work for xonsh.