Colorama.init escapes all ansi codes by default on stdout / stderr when not in a tty, regardless of OS, which breaks color output. Instead of globally affecting stdout and stderr at library import time, only wrap the stream that Halo uses.
Also, I turned colorama into a conditional dependency, seeing as its only needed on windows.
Something to note: there's a change in behavior here.
You may consider using colorama to strip the output when the stream is not a tty, regardless of OS, but you should likely have a way to override the behavior. (See also: https://github.com/tartley/colorama/pull/230)
Checklist
[x] Your branch is up-to-date with the base branch
[ ] You've included at least one test if this is a new feature
Description of new feature, or changes
Colorama.init escapes all ansi codes by default on stdout / stderr when not in a tty, regardless of OS, which breaks color output. Instead of globally affecting stdout and stderr at library import time, only wrap the stream that Halo uses.
Also, I turned colorama into a conditional dependency, seeing as its only needed on windows.
Something to note: there's a change in behavior here.
(convert: ansi converted to win32 calls, strip: ansi removed, ansi: ansi unchanged)
You may consider using colorama to strip the output when the stream is not a tty, regardless of OS, but you should likely have a way to override the behavior. (See also: https://github.com/tartley/colorama/pull/230)
Checklist
Related Issues and Discussions
https://github.com/manrajgrover/halo/issues/151
People to notify