Skip to content

Instantly share code, notes, and snippets.

@levicole
Created August 4, 2017 00:31
Show Gist options
  • Save levicole/97b75ce32fdd63b7d75ed80921098b56 to your computer and use it in GitHub Desktop.
Save levicole/97b75ce32fdd63b7d75ed80921098b56 to your computer and use it in GitHub Desktop.
Random Color Printer
text = ARGV
colorized = text.map do |word|
r = rand(256)
g = rand(256)
b = rand(256)
"\x1b[38;2;#{r};#{g};#{b}m#{word}\x1b[0m"
end.join(" ")
STDOUT.print "#{colorized}\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment