Fix special ansi sequences not ignored and producing wrong colors #222
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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;46m
and 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:
skip
truthy value most of the time.\x1b[38;0;31m
or\x1b[38;48;5;46m
. According to my observations on Linux, if the ansi code folowing38
is not2
nor5
, the sequence should be ignored (but another one can start immediatly).Feel free to suggest improvements. 👍