Skip to content

Terminal Colors

  • Check all available colors using this script:
Bash
#!/bin/bash
color(){
    for c; do
        printf '\e[48;5;%dm%03d' $c $c
    done
    printf '\e[0m \n'
}

IFS=$' \t\n'
color {0..15}
for ((i=0;i<6;i++)); do
    color $(seq $((i*36+16)) $((i*36+51)))
done
color {232..255}

Usage

Bash
export RED="tput setaf 1"
export GREEN="tput setaf 2"
export PURPLE="tput setaf 5"
Bash
$RED; echo "this is red"
Back to top