summaryrefslogtreecommitdiff
path: root/bin/tc
diff options
context:
space:
mode:
Diffstat (limited to 'bin/tc')
-rwxr-xr-xbin/tc20
1 files changed, 20 insertions, 0 deletions
diff --git a/bin/tc b/bin/tc
new file mode 100755
index 0000000..50ae67f
--- /dev/null
+++ b/bin/tc
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+# Set terminal color in xterm and compatibles
+
+color() {
+ case $1 in
+ (0|w|white) bg='#ffffff' ;;
+ (1|g|gray) bg='#eeeeee' ;;
+ (2|b|blue) bg='#cfffff' ;;
+ (3|r|red) bg='#fff0ff' ;;
+ (4|y|yellow) bg='#ffffe0' ;;
+ (5|n|green) bg='#e0ffe0' ;;
+ (6|o|orange) bg='#fff0f4' ;;
+ (7|k|black) bg='#111111' fg='#eeeeee' ;;
+ esac
+}
+
+color ${1:-$((RANDOM % 7))}
+printf '\E]11;'$bg'\E\'
+printf '\E]10;'${fg:-#000000}'\E\'