Skip to content

Instantly share code, notes, and snippets.

@max-did-it
Created March 17, 2020 07:18
Show Gist options
  • Save max-did-it/2efabf3c695728f791f9b9b6880a6b3c to your computer and use it in GitHub Desktop.
Save max-did-it/2efabf3c695728f791f9b9b6880a6b3c to your computer and use it in GitHub Desktop.
String.class_eval do
COLORS = {
white: "\033[37m",
yellow: "\033[33m",
green: "\033[32m",
blue: "\033[34m",
cyan: "\033[36m",
red: "\033[31m",
magenta: "\033[35m",
black: "\033[30m"
}
OFFCOLOR = "\033[0,0m"
def colorize
"#{COLORS[COLORS.keys.sample]}#{self}#{OFFCOLOR}"
end
end
loop { s = rand(500..1000).times.map { 10.times.map { rand(40..140).chr }.join('').colorize }.join(''); puts s; sleep(0.04) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment