Skip to content

Commit

Permalink
easylogging++: Generalize TERM rule for color-supporting terminals
Browse files Browse the repository at this point in the history
With newer versions of tmux, such as version 3.4 packaged by Ubuntu
24.04, this is the default TERM variable value.

Instead of adding it specifically, extend the rule to look for
`-color` or `-256color` in TERM, as these can all be assumed to support
color.
  • Loading branch information
laanwj committed Feb 5, 2025
1 parent 662d246 commit e0dbf91
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions external/easylogging++/easylogging++.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1246,9 +1246,9 @@ std::string OS::currentHost(void) {

bool OS::termSupportsColor(void) {
std::string term = getEnvironmentVariable("TERM", "");
return term == "xterm" || term == "xterm-color" || term == "xterm-256color"
|| term == "screen" || term == "linux" || term == "cygwin"
|| term == "screen-256color" || term == "screen.xterm-256color";
return term == "xterm" || term == "screen" || term == "linux" || term == "cygwin"
|| term.find("-color") != std::string::npos
|| term.find("-256color") != std::string::npos;
}

// DateTime
Expand Down

0 comments on commit e0dbf91

Please sign in to comment.