From f130384cd8e7f894a29b6412ea36b31f72d4e771 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Mon, 6 Jan 2025 18:01:45 +0100 Subject: update --- bin/tc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'bin/tc') diff --git a/bin/tc b/bin/tc index 12129af..e2e34a4 100755 --- a/bin/tc +++ b/bin/tc @@ -1,7 +1,9 @@ -#!/bin/bash +#!/bin/sh # Set terminal color in xterm and compatibles +usage="Usage: $0 [black | blue | cyan | gray | green | magenta | orange | red | white | yellow]" + color() { case $1 in (0|w|white) bg='#ffffff' ;; @@ -11,10 +13,11 @@ color() { (4|y|yellow) bg='#ffffe0' ;; (5|n|green) bg='#e0ffe0' ;; (6|o|orange) bg='#fff0f4' ;; - (7|k|black) bg='#111111' fg='#eeeeee' ;; + (7|k|black) bg='#000000' fg='#eeeeee' ;; esac + printf '\e]11;'${bg:-#ffffff}'\e\' # Set background color. + printf '\e]10;'${fg:-#000000}'\e\' # Set foreground color. } +case $1 in -*) echo "$usage" >&2; exit 1;; esac color ${1:-$((RANDOM % 7))} -printf '\E]11;'${bg:-#ffffff}'\E\' # Set background color. -printf '\E]10;'${fg:-#000000}'\E\' # Set foreground color. -- cgit v1.2.3