blob: 12129af7cbc0c7ea73e115574e6dd350bb65e0e3 (
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:-#ffffff}'\E\' # Set background color.
printf '\E]10;'${fg:-#000000}'\E\' # Set foreground color.
|