Skip to content

Instantly share code, notes, and snippets.

@unicornist
Forked from daytonn/.colors
Last active November 30, 2020 23:23
Show Gist options
  • Select an option

  • Save unicornist/6ddb669d9e6da9f3cd6a8ee75c3f4469 to your computer and use it in GitHub Desktop.

Select an option

Save unicornist/6ddb669d9e6da9f3cd6a8ee75c3f4469 to your computer and use it in GitHub Desktop.

Revisions

  1. unicornist revised this gist Nov 30, 2020. 1 changed file with 24 additions and 64 deletions.
    88 changes: 24 additions & 64 deletions .colors
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,3 @@
    # Colors
    end="\033[0m"
    black="\033[0;30m"
    blackb="\033[1;30m"
    white="\033[0;37m"
    @@ -14,110 +12,72 @@ blue="\033[0;34m"
    blueb="\033[1;34m"
    purple="\033[0;35m"
    purpleb="\033[1;35m"
    lightblue="\033[0;36m"
    lightblueb="\033[1;36m"
    cyan="\033[0;36m"
    cyanb="\033[1;36m"

    end="\033[0m"


    function black {
    echo -e "${black}${1}${end}"
    echo -e "$black$@$end"
    }

    function blackb {
    echo -e "${blackb}${1}${end}"
    echo -e "$blackb$@$end"
    }

    function white {
    echo -e "${white}${1}${end}"
    echo -e "$white$@$end"
    }

    function whiteb {
    echo -e "${whiteb}${1}${end}"
    echo -e "$whiteb$@$end"
    }

    function red {
    echo -e "${red}${1}${end}"
    echo -e "$red$@$end"
    }

    function redb {
    echo -e "${redb}${1}${end}"
    echo -e "$redb$@$end"
    }

    function green {
    echo -e "${green}${1}${end}"
    echo -e "$green$@$end"
    }

    function greenb {
    echo -e "${greenb}${1}${end}"
    echo -e "$greenb$@$end"
    }

    function yellow {
    echo -e "${yellow}${1}${end}"
    echo -e "$yellow$@$end"
    }

    function yellowb {
    echo -e "${yellowb}${1}${end}"
    echo -e "$yellowb$@$end"
    }

    function blue {
    echo -e "${blue}${1}${end}"
    echo -e "$blue$@$end"
    }

    function blueb {
    echo -e "${blueb}${1}${end}"
    echo -e "$blueb$@$end"
    }

    function purple {
    echo -e "${purple}${1}${end}"
    echo -e "$purple$@$end"
    }

    function purpleb {
    echo -e "${purpleb}${1}${end}"
    echo -e "$purpleb$@$end"
    }

    function lightblue {
    echo -e "${lightblue}${1}${end}"
    function cyan {
    echo -e "$cyan$@$end"
    }

    function lightblueb {
    echo -e "${lightblueb}${1}${end}"
    }

    function colors {
    black "black"
    blackb "blackb"
    white "white"
    whiteb "whiteb"
    red "red"
    redb "redb"
    green "green"
    greenb "greenb"
    yellow "yellow"
    yellowb "yellowb"
    blue "blue"
    blueb "blueb"
    purple "purple"
    purpleb "purpleb"
    lightblue "lightblue"
    lightblueb "lightblueb"
    }

    function colortest {
    if [[ -n "$1" ]]; then
    T="$1"
    fi
    T='gYw' # The test text

    echo -e "\n 40m 41m 42m 43m\
    44m 45m 46m 47m";

    for FGs in ' m' ' 1m' ' 30m' '1;30m' ' 31m' '1;31m' ' 32m' \
    '1;32m' ' 33m' '1;33m' ' 34m' '1;34m' ' 35m' '1;35m' \
    ' 36m' '1;36m' ' 37m' '1;37m';
    do FG=${FGs// /}
    echo -en " $FGs \033[$FG $T "
    for BG in 40m 41m 42m 43m 44m 45m 46m 47m;
    do echo -en "$EINS \033[$FG\033[$BG $T \033[0m";
    done
    echo;
    done
    echo
    }
    function cyanb {
    echo -e "$cyanb$@$end"
    }
  2. Dayton Nolan created this gist Jan 28, 2014.
    123 changes: 123 additions & 0 deletions .colors
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,123 @@
    # Colors
    end="\033[0m"
    black="\033[0;30m"
    blackb="\033[1;30m"
    white="\033[0;37m"
    whiteb="\033[1;37m"
    red="\033[0;31m"
    redb="\033[1;31m"
    green="\033[0;32m"
    greenb="\033[1;32m"
    yellow="\033[0;33m"
    yellowb="\033[1;33m"
    blue="\033[0;34m"
    blueb="\033[1;34m"
    purple="\033[0;35m"
    purpleb="\033[1;35m"
    lightblue="\033[0;36m"
    lightblueb="\033[1;36m"

    function black {
    echo -e "${black}${1}${end}"
    }

    function blackb {
    echo -e "${blackb}${1}${end}"
    }

    function white {
    echo -e "${white}${1}${end}"
    }

    function whiteb {
    echo -e "${whiteb}${1}${end}"
    }

    function red {
    echo -e "${red}${1}${end}"
    }

    function redb {
    echo -e "${redb}${1}${end}"
    }

    function green {
    echo -e "${green}${1}${end}"
    }

    function greenb {
    echo -e "${greenb}${1}${end}"
    }

    function yellow {
    echo -e "${yellow}${1}${end}"
    }

    function yellowb {
    echo -e "${yellowb}${1}${end}"
    }

    function blue {
    echo -e "${blue}${1}${end}"
    }

    function blueb {
    echo -e "${blueb}${1}${end}"
    }

    function purple {
    echo -e "${purple}${1}${end}"
    }

    function purpleb {
    echo -e "${purpleb}${1}${end}"
    }

    function lightblue {
    echo -e "${lightblue}${1}${end}"
    }

    function lightblueb {
    echo -e "${lightblueb}${1}${end}"
    }

    function colors {
    black "black"
    blackb "blackb"
    white "white"
    whiteb "whiteb"
    red "red"
    redb "redb"
    green "green"
    greenb "greenb"
    yellow "yellow"
    yellowb "yellowb"
    blue "blue"
    blueb "blueb"
    purple "purple"
    purpleb "purpleb"
    lightblue "lightblue"
    lightblueb "lightblueb"
    }

    function colortest {
    if [[ -n "$1" ]]; then
    T="$1"
    fi
    T='gYw' # The test text

    echo -e "\n 40m 41m 42m 43m\
    44m 45m 46m 47m";

    for FGs in ' m' ' 1m' ' 30m' '1;30m' ' 31m' '1;31m' ' 32m' \
    '1;32m' ' 33m' '1;33m' ' 34m' '1;34m' ' 35m' '1;35m' \
    ' 36m' '1;36m' ' 37m' '1;37m';
    do FG=${FGs// /}
    echo -en " $FGs \033[$FG $T "
    for BG in 40m 41m 42m 43m 44m 45m 46m 47m;
    do echo -en "$EINS \033[$FG\033[$BG $T \033[0m";
    done
    echo;
    done
    echo
    }