summaryrefslogtreecommitdiff
path: root/bin/tc
blob: 50ae67f59372e94bdc5d85fc3d6b56b7c877c01e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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\'