Conversation
I would like to use these two methods in my code because I want to append only the start ANSI escape sequence, not the end. I want to append the end at a different time. This would allow me to implement something efficiently.
|
I resolved the conflicts, fixed some bugs and deprecated a method. Can this please be reviewed? |
Co-Authored-By: Sijawusz Pur Rahnama <sija@sija.pl>
|
Bump, this still on anyone's radar? Seems it needs another rebase... |
|
Hello, I don't think there is interest in this PR but I resolved the conflicts anyway. It's unfortunate that this wasn't merged before 1.0 because it does some breaking changes like removing |
|
I think most of this is really good, but it's also a bunch of different changes merged together. It's hard to review. IMO it would be easier to merge in spearate chunks. Ideally, I think each of the bullet points in the OP should be a separate PR. Maybe some could be merged, but to me it seems they're for the most part independent changes. As you already mentioned, we can't simply remove |
| if mode == Mode::Bright | ||
| puts "Warning: The text decoration `bright` is deprecated. Please use `bold` instead.".colorize(:light_yellow) unless @@warning_printed | ||
| @@warning_printed = true | ||
| end |
There was a problem hiding this comment.
Do deprecation warnings work on enum members? Don't think the annotation existed when this PR was made but that would prob be more ideal.
There was a problem hiding this comment.
Yes, it would be nice if that worked but they don't work.
|
I have re-added |
|
|
Originally part of #7690, this seems to be the more sensible behavior compared to ignoring non-terminal streams and `$TERM`. This does not deprecate `.on_tty_only!` because it is still useful after the default is overridden. Effectively reverts #14258. Co-authored-by: Johannes Müller <straightshoota@gmail.com>
This:
Colorizeand improves some.Colorize.on_tty_only!and makes it the default so you don't have to put it at the beginning of every program that usesColorizebecause you don't want that your program behaves badly in non-TTY terminals (i.e. that the ANSI escape codes become visible). Most people don't do this/forget it.Fixes Remove manual symbols in Crystal with automatic casting enums? #6736 because as to my knowledge there are no other examples where enums are being manually duplicated as symbols.
Object.colorize(r, g, b)which is a syntactic sugar forObject.colorize(Colorize::ColorRGB.new(r, g, b)). It's a bit of an alias but I'd say it's rather syntactic sugar and less worse than all the other aliases inColorize."hello".colorize(:red).inspectreturning"hello"in red instead of"\e[31mhello\e[0m"which is probably what you want when you inspect a colored string.bright. See Improve Colorize #7690 (comment).