Created
March 23, 2011 00:34
-
-
Save evantahler/882400 to your computer and use it in GitHub Desktop.
A note on how to color stuff in the shell
This file contains 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
echo $'\033[31mChoose one of the following persons:\033[0m SOMETHNG ELSE' | |
def color(text, color_code) | |
color_enabled? ? "#{color_code}#{text}\e[0m" : text | |
end | |
def bold(text) | |
color(text, "\e[1m") | |
end | |
def white(text) | |
color(text, "\e[37m") | |
end | |
def green(text) | |
color(text, "\e[32m") | |
end | |
def red(text) | |
color(text, "\e[31m") | |
end | |
def magenta(text) | |
color(text, "\e[35m") | |
end | |
def yellow(text) | |
color(text, "\e[33m") | |
end | |
def blue(text) | |
color(text, "\e[34m") | |
end | |
def grey(text) | |
color(text, "\e[90m") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment