Add detection of true color support

This commit is contained in:
Bob Polis 2024-01-18 10:42:18 +01:00
parent d6abc4512b
commit a9fccef300

View File

@ -1,5 +1,6 @@
#include <iostream>
#include <ctime>
#include <cstdlib>
#include <libscterm.hpp>
void show_rows_cols(const sc::term& t) {
@ -117,6 +118,10 @@ void show_words() {
}
void show_truecolor(const sc::term& t) {
// check for true color support
char* support = getenv("COLORTERM");
if (!support || support[0] == '\0') return;
const char* lhb = u8"\u2584"; // lower half block
int inc = 6.0 * t.cols() / 256.0;
if (inc == 0) inc = 1;