diff --git a/src/pixels.cpp b/src/pixels.cpp index b0d7cb0..7dda8ce 100644 --- a/src/pixels.cpp +++ b/src/pixels.cpp @@ -9,9 +9,12 @@ static inline int t2p(int val) { } static void write(std::ostream& os, FILE* in) { - char* tc = getenv("TRUECOLOR"); - std::string truecolor {tc ? tc : ""}; - bool has_truecolor = truecolor.size() > 0; + char* tc = getenv("COLORTERM"); + std::string colorterm {tc ? tc : ""}; + bool has_truecolor = colorterm.size() > 0; + if (has_truecolor) { + has_truecolor = colorterm == "truecolor" || colorterm == "24bit"; + } struct pam info; pnm_readpaminit(in, &info, PAM_STRUCT_SIZE(tuple_type)); std::unique_ptr row1 {pnm_allocpamrow(&info), pm_freerow};