-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add uncolor method #54
Conversation
fa8d602
to
e776955
Compare
e776955
to
3ec8d82
Compare
rebased! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that the code is neat, and that the name is OK.
The name wrap_with_sgr
has the SGR name in it; perhaps this stripping removes any control character, not only the graphics-related ones.
Good observation @olleolleolle. SGR stands for Set Graphics Rendition, and in addition to dealing with colors it also allows setting/unsetting other text attributes like bold, blinking, italic, underline and few others. This new method strips all ANSI escape sequences, not only SGR, so the name is appropriate in my opinion. I hesitated to merge this because so far Rainbow only dealt with SGR seqs (escape seqs ending in |
We can either merge it as it is now, or modify regex to only strip ones ending in |
3ec8d82
to
20136d7
Compare
Changed to |
20136d7
to
48fbee5
Compare
48fbee5
to
bfcc7ef
Compare
Sorry, I've been busy recently. This looks good, let's merge it 👍 |
Similar method exists in Perl's Term:ANSIColor as uncolor().
It is useful when: