Skip to content

Instantly share code, notes, and snippets.

@bcap
Last active September 21, 2025 10:46
Show Gist options
  • Save bcap/5682077 to your computer and use it in GitHub Desktop.
Save bcap/5682077 to your computer and use it in GitHub Desktop.

Revisions

  1. bcap revised this gist May 31, 2013. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions terminal-control.sh
    Original file line number Diff line number Diff line change
    @@ -30,6 +30,6 @@ Cyan="${TC}36m"; ICyan="${TC}96m"; OnCyan="${TC}46m"; OnICyan="${TC}106m";
    White="${TC}37m"; IWhite="${TC}97m"; OnWhite="${TC}47m"; OnIWhite="${TC}107m";

    # examples
    # echo "${Bold}${Red}bold red on ${On_Blue}blue background,${RegB} now back to regular background, ${RegF}regular foreground and ${Reg}regular text"
    # echo "${Bold}${Red}bold red on ${OnBlue}blue background,${RegB} now back to regular background, ${RegF}regular foreground and ${Reg}regular text"
    # echo "${Bold}${Undr}${Green}You can reset this whole style in one${Rst} command"
    # echo -n "${Bold}${Blue}${On_White}bold blue text on white background${Rst}"; sleep 3; echo "${RESET_LINE}${Red}${On_Yellow}becomes red text on yellow background${Rst}"
    # echo -n "${Bold}${Blue}${OnWhite}bold blue text on white background${Rst}"; sleep 3; echo "${RESET_LINE}${Red}${OnYellow}becomes red text on yellow background${Rst}"
  2. bcap revised this gist May 31, 2013. 1 changed file with 9 additions and 9 deletions.
    18 changes: 9 additions & 9 deletions terminal-control.sh
    Original file line number Diff line number Diff line change
    @@ -19,15 +19,15 @@ RegF="${TC}39m" # Regular foreground coloring
    RegB="${TC}49m" # Regular background coloring
    Rst="${TC}0m" # Reset all coloring and style

    # Basic High Intensity Background High Intensity Background
    Black="${TC}30m"; IBlack="${TC}90m"; On_Black="${TC}40m"; On_IBlack="${TC}100m";
    Red="${TC}31m"; IRed="${TC}91m"; On_Red="${TC}41m"; On_IRed="${TC}101m";
    Green="${TC}32m"; IGreen="${TC}92m"; On_Green="${TC}42m"; On_IGreen="${TC}102m";
    Yellow="${TC}33m"; IYellow="${TC}93m"; On_Yellow="${TC}43m"; On_IYellow="${TC}103m";
    Blue="${TC}34m"; IBlue="${TC}94m"; On_Blue="${TC}44m"; On_IBlue="${TC}104m";
    Purple="${TC}35m"; IPurple="${TC}95m"; On_Purple="${TC}45m"; On_IPurple="${TC}105m";
    Cyan="${TC}36m"; ICyan="${TC}96m"; On_Cyan="${TC}46m"; On_ICyan="${TC}106m";
    White="${TC}37m"; IWhite="${TC}97m"; On_White="${TC}47m"; On_IWhite="${TC}107m";
    # Basic High Intensity Background High Intensity Background
    Black="${TC}30m"; IBlack="${TC}90m"; OnBlack="${TC}40m"; OnIBlack="${TC}100m";
    Red="${TC}31m"; IRed="${TC}91m"; OnRed="${TC}41m"; OnIRed="${TC}101m";
    Green="${TC}32m"; IGreen="${TC}92m"; OnGreen="${TC}42m"; OnIGreen="${TC}102m";
    Yellow="${TC}33m"; IYellow="${TC}93m"; OnYellow="${TC}43m"; OnIYellow="${TC}103m";
    Blue="${TC}34m"; IBlue="${TC}94m"; OnBlue="${TC}44m"; OnIBlue="${TC}104m";
    Purple="${TC}35m"; IPurple="${TC}95m"; OnPurple="${TC}45m"; OnIPurple="${TC}105m";
    Cyan="${TC}36m"; ICyan="${TC}96m"; OnCyan="${TC}46m"; OnICyan="${TC}106m";
    White="${TC}37m"; IWhite="${TC}97m"; OnWhite="${TC}47m"; OnIWhite="${TC}107m";

    # examples
    # echo "${Bold}${Red}bold red on ${On_Blue}blue background,${RegB} now back to regular background, ${RegF}regular foreground and ${Reg}regular text"
  3. bcap revised this gist May 31, 2013. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion terminal-control.sh
    Original file line number Diff line number Diff line change
    @@ -6,9 +6,10 @@ CLR_LINE_START="${TC}1K"
    CLR_LINE_END="${TC}K"
    CLR_LINE="${TC}2K"

    # Hope no terminal is greater than 1k columns
    RESET_LINE="${CLR_LINE}${TC}1000D"

    # Colors
    # Colors and styles (based on https://github.com/demure/dotfiles/blob/master/subbash/prompt)

    Bold="${TC}1m" # Bold text only, keep colors
    Undr="${TC}4m" # Underline text only, keep colors
  4. bcap revised this gist May 31, 2013. 1 changed file with 21 additions and 14 deletions.
    35 changes: 21 additions & 14 deletions terminal-control.sh
    Original file line number Diff line number Diff line change
    @@ -6,22 +6,29 @@ CLR_LINE_START="${TC}1K"
    CLR_LINE_END="${TC}K"
    CLR_LINE="${TC}2K"

    # Hope no terminal is greater than 1k columns
    RESET_LINE="${CLR_LINE}${TC}1000D"

    # Colors (based on https://github.com/demure/dotfiles/blob/master/subbash/prompt)
    # Colors

    RCol="${TC}0m" # Reset Color
    Bold="${TC}1m" # Bold text only, keep colors
    Undr="${TC}4m" # Underline text only, keep colors
    Inv="${TC}7m" # Inverse: swap background and foreground colors
    Reg="${TC}22;24m" # Regular text only, keep colors
    RegF="${TC}39m" # Regular foreground coloring
    RegB="${TC}49m" # Regular background coloring
    Rst="${TC}0m" # Reset all coloring and style

    # Regular Bold Underline High Intensity BoldHigh Intensity Background High Intensity Backgrounds
    Bla="${TC}0;30m"; BBla="${TC}1;30m"; UBla="${TC}4;30m"; IBla="${TC}0;90m"; BIBla="${TC}1;90m"; On_Bla="${TC}40m"; On_IBla="${TC}0;100m";
    Red="${TC}0;31m"; BRed="${TC}1;31m"; URed="${TC}4;31m"; IRed="${TC}0;91m"; BIRed="${TC}1;91m"; On_Red="${TC}41m"; On_IRed="${TC}0;101m";
    Gre="${TC}0;32m"; BGre="${TC}1;32m"; UGre="${TC}4;32m"; IGre="${TC}0;92m"; BIGre="${TC}1;92m"; On_Gre="${TC}42m"; On_IGre="${TC}0;102m";
    Yel="${TC}0;33m"; BYel="${TC}1;33m"; UYel="${TC}4;33m"; IYel="${TC}0;93m"; BIYel="${TC}1;93m"; On_Yel="${TC}43m"; On_IYel="${TC}0;103m";
    Blu="${TC}0;34m"; BBlu="${TC}1;34m"; UBlu="${TC}4;34m"; IBlu="${TC}0;94m"; BIBlu="${TC}1;94m"; On_Blu="${TC}44m"; On_IBlu="${TC}0;104m";
    Pur="${TC}0;35m"; BPur="${TC}1;35m"; UPur="${TC}4;35m"; IPur="${TC}0;95m"; BIPur="${TC}1;95m"; On_Pur="${TC}45m"; On_IPur="${TC}0;105m";
    Cya="${TC}0;36m"; BCya="${TC}1;36m"; UCya="${TC}4;36m"; ICya="${TC}0;96m"; BICya="${TC}1;96m"; On_Cya="${TC}46m"; On_ICya="${TC}0;106m";
    Whi="${TC}0;37m"; BWhi="${TC}1;37m"; UWhi="${TC}4;37m"; IWhi="${TC}0;97m"; BIWhi="${TC}1;97m"; On_Whi="${TC}47m"; On_IWhi="${TC}0;107m";
    # Basic High Intensity Background High Intensity Background
    Black="${TC}30m"; IBlack="${TC}90m"; On_Black="${TC}40m"; On_IBlack="${TC}100m";
    Red="${TC}31m"; IRed="${TC}91m"; On_Red="${TC}41m"; On_IRed="${TC}101m";
    Green="${TC}32m"; IGreen="${TC}92m"; On_Green="${TC}42m"; On_IGreen="${TC}102m";
    Yellow="${TC}33m"; IYellow="${TC}93m"; On_Yellow="${TC}43m"; On_IYellow="${TC}103m";
    Blue="${TC}34m"; IBlue="${TC}94m"; On_Blue="${TC}44m"; On_IBlue="${TC}104m";
    Purple="${TC}35m"; IPurple="${TC}95m"; On_Purple="${TC}45m"; On_IPurple="${TC}105m";
    Cyan="${TC}36m"; ICyan="${TC}96m"; On_Cyan="${TC}46m"; On_ICyan="${TC}106m";
    White="${TC}37m"; IWhite="${TC}97m"; On_White="${TC}47m"; On_IWhite="${TC}107m";

    # example:
    # echo -n "${BBlu}${On_Whi}bold blue text on white background${RCol}"; sleep 3; echo "${RESET_LINE}${Red}${On_Pur}becomes red text on purple background${RCol}"
    # examples
    # echo "${Bold}${Red}bold red on ${On_Blue}blue background,${RegB} now back to regular background, ${RegF}regular foreground and ${Reg}regular text"
    # echo "${Bold}${Undr}${Green}You can reset this whole style in one${Rst} command"
    # echo -n "${Bold}${Blue}${On_White}bold blue text on white background${Rst}"; sleep 3; echo "${RESET_LINE}${Red}${On_Yellow}becomes red text on yellow background${Rst}"
  5. bcap revised this gist May 30, 2013. 1 changed file with 5 additions and 2 deletions.
    7 changes: 5 additions & 2 deletions terminal-control.sh
    Original file line number Diff line number Diff line change
    @@ -11,7 +11,7 @@ RESET_LINE="${CLR_LINE}${TC}1000D"

    # Colors (based on https://github.com/demure/dotfiles/blob/master/subbash/prompt)

    RCol='${TC}0m' # Reset Color
    RCol="${TC}0m" # Reset Color

    # Regular Bold Underline High Intensity BoldHigh Intensity Background High Intensity Backgrounds
    Bla="${TC}0;30m"; BBla="${TC}1;30m"; UBla="${TC}4;30m"; IBla="${TC}0;90m"; BIBla="${TC}1;90m"; On_Bla="${TC}40m"; On_IBla="${TC}0;100m";
    @@ -21,4 +21,7 @@ Yel="${TC}0;33m"; BYel="${TC}1;33m"; UYel="${TC}4;33m"; IYel="${TC}0;93m"; B
    Blu="${TC}0;34m"; BBlu="${TC}1;34m"; UBlu="${TC}4;34m"; IBlu="${TC}0;94m"; BIBlu="${TC}1;94m"; On_Blu="${TC}44m"; On_IBlu="${TC}0;104m";
    Pur="${TC}0;35m"; BPur="${TC}1;35m"; UPur="${TC}4;35m"; IPur="${TC}0;95m"; BIPur="${TC}1;95m"; On_Pur="${TC}45m"; On_IPur="${TC}0;105m";
    Cya="${TC}0;36m"; BCya="${TC}1;36m"; UCya="${TC}4;36m"; ICya="${TC}0;96m"; BICya="${TC}1;96m"; On_Cya="${TC}46m"; On_ICya="${TC}0;106m";
    Whi="${TC}0;37m"; BWhi="${TC}1;37m"; UWhi="${TC}4;37m"; IWhi="${TC}0;97m"; BIWhi="${TC}1;97m"; On_Whi="${TC}47m"; On_IWhi="${TC}0;107m";
    Whi="${TC}0;37m"; BWhi="${TC}1;37m"; UWhi="${TC}4;37m"; IWhi="${TC}0;97m"; BIWhi="${TC}1;97m"; On_Whi="${TC}47m"; On_IWhi="${TC}0;107m";

    # example:
    # echo -n "${BBlu}${On_Whi}bold blue text on white background${RCol}"; sleep 3; echo "${RESET_LINE}${Red}${On_Pur}becomes red text on purple background${RCol}"
  6. bcap created this gist May 30, 2013.
    24 changes: 24 additions & 0 deletions terminal-control.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,24 @@
    # Terminal output control (http://www.termsys.demon.co.uk/vtansi.htm)

    TC='\e['

    CLR_LINE_START="${TC}1K"
    CLR_LINE_END="${TC}K"
    CLR_LINE="${TC}2K"

    # Hope no terminal is greater than 1k columns
    RESET_LINE="${CLR_LINE}${TC}1000D"

    # Colors (based on https://github.com/demure/dotfiles/blob/master/subbash/prompt)

    RCol='${TC}0m' # Reset Color

    # Regular Bold Underline High Intensity BoldHigh Intensity Background High Intensity Backgrounds
    Bla="${TC}0;30m"; BBla="${TC}1;30m"; UBla="${TC}4;30m"; IBla="${TC}0;90m"; BIBla="${TC}1;90m"; On_Bla="${TC}40m"; On_IBla="${TC}0;100m";
    Red="${TC}0;31m"; BRed="${TC}1;31m"; URed="${TC}4;31m"; IRed="${TC}0;91m"; BIRed="${TC}1;91m"; On_Red="${TC}41m"; On_IRed="${TC}0;101m";
    Gre="${TC}0;32m"; BGre="${TC}1;32m"; UGre="${TC}4;32m"; IGre="${TC}0;92m"; BIGre="${TC}1;92m"; On_Gre="${TC}42m"; On_IGre="${TC}0;102m";
    Yel="${TC}0;33m"; BYel="${TC}1;33m"; UYel="${TC}4;33m"; IYel="${TC}0;93m"; BIYel="${TC}1;93m"; On_Yel="${TC}43m"; On_IYel="${TC}0;103m";
    Blu="${TC}0;34m"; BBlu="${TC}1;34m"; UBlu="${TC}4;34m"; IBlu="${TC}0;94m"; BIBlu="${TC}1;94m"; On_Blu="${TC}44m"; On_IBlu="${TC}0;104m";
    Pur="${TC}0;35m"; BPur="${TC}1;35m"; UPur="${TC}4;35m"; IPur="${TC}0;95m"; BIPur="${TC}1;95m"; On_Pur="${TC}45m"; On_IPur="${TC}0;105m";
    Cya="${TC}0;36m"; BCya="${TC}1;36m"; UCya="${TC}4;36m"; ICya="${TC}0;96m"; BICya="${TC}1;96m"; On_Cya="${TC}46m"; On_ICya="${TC}0;106m";
    Whi="${TC}0;37m"; BWhi="${TC}1;37m"; UWhi="${TC}4;37m"; IWhi="${TC}0;97m"; BIWhi="${TC}1;97m"; On_Whi="${TC}47m"; On_IWhi="${TC}0;107m";