diff options
| author | Marc Vertes <mvertes@free.fr> | 2025-01-15 11:44:13 +0100 |
|---|---|---|
| committer | Marc Vertes <mvertes@free.fr> | 2025-01-15 11:44:13 +0100 |
| commit | 307df21222316d35f32e1597824283797aa6a74c (patch) | |
| tree | bf6a73f1be8f76cfcb95cde4e48a8ada9ff6bce4 /bin/tc | |
| parent | 137fd617030c85e9eef6858d9d5cd63cdc306ff6 (diff) | |
update
Diffstat (limited to 'bin/tc')
| -rwxr-xr-x | bin/tc | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -1,6 +1,8 @@ -#!/bin/bash +#!/bin/sh -# Set terminal color in xterm and compatibles. +# Set terminal color in xterm and compatibles + +usage="Usage: $0 [black | blue | cyan | gray | green | magenta | orange | red | white | yellow]" color() { case $1 in @@ -11,11 +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' ;; - (*) echo "$0: unknown color $1">&2; exit 1 ;; + (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\' -printf '\E]10;'${fg:-#000000}'\E\' |
