~mdkcore/dotbins

dotbins/show-ansi-colors.sh -rwxr-xr-x 412 bytes
2559c86bRodrigo Oliveira [power] Use loginctl instead of pm-* 1 year, 9 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env sh

#original: https://gist.github.com/eliranmal/b373abbe1c21e991b394bdffb0c8a6cf

usage() {
    echo "show-ansi-colors <n>"
    exit 0
}

(( $# < 1 )) && usage

show_ansi_colors() {
    local colors=$1
    echo "showing $colors ansi colors:"
    for (( n=-0; n < $colors; n++ )) do
        printf " [%d]\t$(tput setab $n)%s$(tput sgr0)\n" $n "        "
    done
    echo
}

show_ansi_colors "$@"