Support for --color on Windows?
amitbora007 opened this issue · 9 comments
unable to use '-color','--color' parameter in both CLI and library import method.
please provide any usage example
Ah, I am unfamiliar with the behaviour of pyfiglet on windows, and this is untested, sorry. It looks like windows doesn't use the same representation to control color. I'm afraid I don't know how to fix this and we need to find a willing windows developer to help out.
Ah, I am unfamiliar with the behaviour of pyfiglet on windows, and this is untested, sorry. It looks like windows doesn't use the same representation to control color. I'm afraid I don't know how to fix this and we need to find a willing windows developer to help out.
okk, thanks for the reply. I will also update if find any fix for this.
I believe you could do something like that:
try:
from colorama import init
init(strip=not sys.stdout.isatty())
from termcolor import cprint
except:
def cprint(text, color):
// use default of pyfliglet colors implementation without dependencies
And then adapt the code in pyfiglet to use that.
On windows, you would just need to pip install colorama and termcolor to get the color support.
If possible it would be great to avoid pulling in another dependency.
At time of writing we have ~300 dependent packages and ~6,000 dependent repositories. Adding an extra dependency means affecting all those other packages. Going from 0 to 1 dependency is a significant step and I don't know how to make it whilst being sure not to break backwards compatibility for everyone.
@amitbora007 it looks like your legacy console doesn't support ANSI sequences. If you have a recent version of Windows you can typically enable it on the console settings panel (menu at top left). Windows terminal might be another option.
Another option is to use colorama, although it isn't necessary any longer to include it as a dependency due to widespread ANSI support.
Ok to close? Looks resolved to me. (use a different console on windows)
I'm happy to close this, please comment to request a reopen (with some details as to why) if needed.