Fix special ansi sequences not ignored and producing wrong colors#222
Fix special ansi sequences not ignored and producing wrong colors#222Delgan wants to merge 2 commits into
Conversation
cfa0ce1 to
caaba84
Compare
Recent versions of the Windows 10 terminal do support them |
|
Hey. FYI, Yesterday I created a PR to test releases before we push them to PyPI. When that is merged, I'll be more confident about resuming merges and releases. I'll try to look at this PR soon. Thank you for creating it! |
|
Apologies for being AWOL for years, but I'm rounding up PRs that should get merged. This sounds AMAZING, and I'd like to merge it. Huge thanks! But I can't merge it without corresponding tests (How will future developers know if their changes break your code?) |
|
Hey @tartley, I just updated the PR by adding unit tests (and slightly modifying the implementation to make it more readable). Please let me know what you think of it! |
f3b71d1 to
7796819
Compare
Hi.
This change is intended to fix #217.
On Linux, special coloration sequences may be initialized with
38(foreground) and48(bakground) ansi codes. 8-bit looks like\x1b[38;5;46mand 24-bit looks like\x1b[38;2;120;33;255m. These colors are not supported by Windows terminal as far as I know (maybe PowerShell console supports it?), so they should be ignored bycolorama, as it is the case for others special styles.Notes about my implementation:
skiptruthy value most of the time.\x1b[38;0;31mor\x1b[38;48;5;46m. According to my observations on Linux, if the ansi code folowing38is not2nor5, the sequence should be ignored (but another one can start immediatly).Feel free to suggest improvements. 👍