Awesome Open Source
Awesome Open Source

ColorEchoForShell

Build Status License badge

Make echo colorful with easier method. In bash, sh, fish, ksh and zsh. Which can help you print debug, warning, error message in shell scripts with meaningful colors, and make the output more readable.

Please note that certain colors will really depend on the environment, different terminal may have different behavior, terminal multiplexer like tmux could also affect the result, especially those color not coded in range 0~7, might have unexpected result with styling. My demo is under a terminal called Terminator, you can simply install it via apt, yum, pkg or other package manager. Actually, all the colors display depend on the environment setting, but I just name/define name by the most common cases I know by far.

MENU

Installation

  • Download the script, choice the one for your shell by its extension in the filename.
  • Add a line to include the script in your shell rc or run it directly:

. ./ColorEcho.bash

Usage

  • echo.StyleColor (if you are using ksh/sh, there is no . dot symbol), you can combine at most two styles together, the order of the style doesn't matter.

Examples

  • echo.Cyan
  • echo.ICyan
  • echo.ULCyan
  • echo.BLCyan
  • echo.STCyan
  • echo.BoldCyan
  • echo.BoldULCyan
  • echo.ULBoldCyan

Supported shells

Supported styles

  • Bold as Bold
  • Italic as I
  • Underline as UL
  • Blink as BL
  • Strikethrough as ST

Supported colors

  • See color table

  • For the standard color(coded in range 0~7), it'll has a light version of the color, just use the Light keyword before the color, for example: LightYellow.

Notes

  • If you have lolcat, you can also try echo.Rainbow.

Screenshot

Screenshot

Demo

Demo

License

GPL-2.0 (GNU GENERAL PUBLIC LICENSE Version 2)

Author

Peter Dave Hello, @Twitter, @GitHub


Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
shell (10,559
hacktoberfest (4,275
bash (639
zsh (322
color (216
script (195
fish (96
echo (35
shellscript (25
sh (20