summaryrefslogtreecommitdiff
path: root/bin/cursor
blob: 6fdbc12fe3515850e56a0dfbf9ca6734e1ba1601 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash

# Set cursor in xterm and compatibles.

cursor() {
	case $1 in 
		(r|red)     cc='#f00' ;;
		(n|green)   cc='#5f5' ;;
		(b|blue)    cc='#55f' ;;
		(c|cyan)    cc='#0ff' ;;
		(y|yellow)  cc='#ff0' ;;
		(m|magenta) cc='#f0f' ;;
		(o|orange)  cc='#f80' ;;
		(k|black)   cc='#111' ;;
		(g|gr[ae]y) cc='#888' ;;
		(w|white)   cc='#eee' ;;
		(*)         cc=$1 ;;
	esac
}

cursor "${1:-red}"
printf '\e]12;'$cc'\e\' # set cursor color