Support true color mode in Terminal.app for known-good versions.

This commit is contained in:
casey langen 2020-02-18 22:55:44 -08:00
parent 0193fb303f
commit 9cb6040491

View File

@ -500,6 +500,16 @@ static bool canChangeColors() {
if (termEnv && strlen(termEnv)) {
term = std::string(termEnv);
if (term == "Apple_Terminal") {
const char* termVer = std::getenv("TERM_PROGRAM_VERSION");
if (termVer && strlen(termVer)) {
/* note that older versions of Terminal.app don't support
true color mode. however, I recently tested with 433 and
it works fine! versions older than 433 may work as well,
but it's untested */
if (atoi(termVer) >= 433) {
return true;
}
}
return false;
}
}