Last active
December 12, 2015 02:48
-
-
Save yaniv-aknin/4701096 to your computer and use it in GitHub Desktop.
Can you think of a better console text colouring library for shell?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!sh | |
| function newline() { printf "$@\n"; } | |
| function color() { | |
| output="\e[$1m" | |
| shift | |
| [ -n "$1" ] && output="$output$@\e[00m" | |
| printf "$output" | |
| } | |
| function reset() { color "00"; } | |
| function red() { color "01;31" "$@"; } | |
| function white() { color "01;37" "$@" ; } | |
| function warning() { | |
| newline "$(red "$@")" | |
| } | |
| function suggestion() { | |
| newline "(run $(white "$1") if you want me to take care of this)" | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment