-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Emit dedicated bright terminal color codes if supported
Some terminals support having a bold normal foreground color which is _not_ bright. kitty is one of them, as well as GNOME Terminal with the fairly recent "Show bold text in bright colors" option turned off (or when calling the underlying vte_terminal_set_bold_is_bright() function with the appropriate value). An easy test is to execute: $ echo -e "\033[31mTHIS\n\033[1mTHAT\033[0m" and compare the colors of both lines: if they are the same, then the terminal supports non-bright bold foreground colors. For those terminals, the way to have a non-bold bright color is to emit the dedicated SGR codes 90 to 97: $ echo -e "\033[91mHELLO\033[0m" Some terminals can print non-bold bright colors, but cannot print non-bright bold colors. This patch makes the Babeltrace project emit different color codes depending on the connected terminal and the new `BABELTRACE_TERM_COLOR_BRIGHT_MEANS_BOLD` environment variable's value: kitty or `BABELTRACE_TERM_COLOR_BRIGHT_MEANS_BOLD` is `0`: Output bright colors using dedicated SGR codes 90 to 97. Otherwise: Output bright colors with bold + SGR codes 30 to 37. This patch effectively makes the Babeltrace modules emit correct bright color codes for kitty. To change as little as possible, I updated all the sites which emit a bold code followed by a foreground color code to emit instead a bold color code followed by a bright foreground color code. The only drawback with the current approach is that, for non-kitty terminals, two bold color codes are emitted for those cases (the real bold and the brightening bold). This means all bold colored text is also bright currently. Eventually we can start decoupling the bold attribute from bright colors if need be, although this means users must have a supporting terminal. Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com> Change-Id: I3e0124942294fbe833d33aa59506c67e6ca85700 Reviewed-on: https://review.lttng.org/c/babeltrace/+/2328 CI-Build: Simon Marchi <simon.marchi@efficios.com> Tested-by: jenkins <jenkins@lttng.org> Reviewed-by: Simon Marchi <simon.marchi@efficios.com> Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
- Loading branch information
Showing
10 changed files
with
374 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.