Skip to content

Instantly share code, notes, and snippets.

@blacktm
Created November 25, 2013 04:25
Show Gist options
  • 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