Skip to content

Instantly share code, notes, and snippets.

@blacktm
Created November 25, 2013 04:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blacktm/7636348 to your computer and use it in GitHub Desktop.
Save blacktm/7636348 to your computer and use it in GitHub Desktop.
A Ruby class extension to color shell output.
class String
def colorize(c); "\e[#{c}m#{self}\e[0m" end
def error; colorize("1;31") end
def bold; colorize("1") end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment