From 9cb6040491e8cebd546c199b2d54af35c9ddcf73 Mon Sep 17 00:00:00 2001 From: casey langen Date: Tue, 18 Feb 2020 22:55:44 -0800 Subject: [PATCH] Support true color mode in Terminal.app for known-good versions. --- src/musikcube/cursespp/Colors.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/musikcube/cursespp/Colors.cpp b/src/musikcube/cursespp/Colors.cpp index 6767e0bc3..9848fd6cd 100755 --- a/src/musikcube/cursespp/Colors.cpp +++ b/src/musikcube/cursespp/Colors.cpp @@ -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; } }