blob: 2ae069b101cec61f9aeb522073efc6b07800388b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#!/bin/sh
# Set cursor in xterm and compatibles.
usage="Usage: $0 [black | blue | cyan | gray | green | magenta | orange | red | white | yellow]"
cursor() {
case $1 in
(0|r|red) set -- '#f00' ;;
(1|n|green) set -- '#5f5' ;;
(2|b|blue) set -- '#55f' ;;
(3|c|cyan) set -- '#0ff' ;;
(4|y|yellow) set -- '#ff0' ;;
(5|m|magenta) set -- '#f0f' ;;
(6|o|orange) set -- '#f80' ;;
(7|g|gr[ae]y) set -- '#888' ;;
(k|black) set -- '#111' ;;
(w|white) set -- '#eee' ;;
esac
printf '\e[2 q\e]12;'$1'\e\' # set non blinking block, then color
}
case $1 in -*) echo "$usage" >&2; exit 1;; esac
cursor "${1:-$((RANDOM % 8))}"
|