Created
June 14, 2016 05:16
-
-
Save pujiaxun/18c473722ab3810501077b0714d456fc to your computer and use it in GitHub Desktop.
A simple patch for String to colorize the output in the terminal.
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
class String | |
def black; "\e[30m#{self}\e[0m" end | |
def red; "\e[31m#{self}\e[0m" end | |
def green; "\e[32m#{self}\e[0m" end | |
def brown; "\e[33m#{self}\e[0m" end | |
def blue; "\e[34m#{self}\e[0m" end | |
def magenta; "\e[35m#{self}\e[0m" end | |
def cyan; "\e[36m#{self}\e[0m" end | |
def gray; "\e[37m#{self}\e[0m" end | |
end | |
# puts "This is green".green | |
# puts "Blue is here".blue |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment