aboutsummaryrefslogtreecommitdiff
path: root/colors/demo.sh
blob: 4bb9f70b036f05237f48bf5898b4428c35dd9aa1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh
. ./ansi.sh
# demo as in starlight.png
# requires truecolor

# for every color:
# color, bright color | bold color, bright bold color

# loop
demopart() {
	eval fgc '$'"$1"
	if [ $# -gt 1 ]; then
		bold
		printf 'bold '
	fi
	# 9 is the length of brmagenta
	printf '%-9s' "$1"
	reset
	bgc $background
}

demo() {
	for col in black red green yellow blue magenta cyan white; do
		printf '%b %b | %b %b\n' "$(demopart $col)" "$(demopart br$col)" \
			"$(demopart $col bold)" "$(demopart br$col bold)"
	done
}

. ./colors.sh
bgc $background
demo
reset