From da83a0ed9376c77b98a8b2bf9d045f9311aeb28c Mon Sep 17 00:00:00 2001 From: Jeremy Kaplan Date: Sun, 4 Feb 2018 16:00:55 -0800 Subject: [PATCH] Add truecolor support to tako --- tako/config.tako | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/tako/config.tako b/tako/config.tako index ac91947..afbdb65 100644 --- a/tako/config.tako +++ b/tako/config.tako @@ -69,7 +69,23 @@ $TAKO_SETTINGS.aliases.update({ }) if 'TERM' in ${...}: - if '256color' in $TERM: + if 'truecolor' in $COLORTERM or '24bit' in $COLORTERM: + colors = { + 'blue': (95, 215, 255), + 'orange': (215, 95, 0), + 'purple': (175, 95, 255), + 'red': (255, 0, 0), + 'green': (135, 255, 0), + 'gray': (98, 98, 98), + } + + def colorize(color, text): + r, g, b = colors[color] + prefix = '\x1b[38;2;{};{};{}m'.format(r, g, b) + suffix = '\x1b[0m' + return prefix + text + suffix + + elif '256color' in $TERM: colors = { 'blue': 81, 'orange': 166,