2022-10-29 10:09:10 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2022-11-16 11:40:52 +00:00
|
|
|
AVAILABLE_COLORS = %i[
|
|
|
|
red green yellow pink
|
|
|
|
].freeze
|
|
|
|
|
2022-10-29 10:09:10 +00:00
|
|
|
# String color
|
|
|
|
class String
|
|
|
|
def colorize(color_code)
|
|
|
|
"\e[#{color_code}m#{self}\e[0m"
|
|
|
|
end
|
|
|
|
|
|
|
|
def red
|
|
|
|
colorize(31)
|
|
|
|
end
|
|
|
|
|
|
|
|
def green
|
|
|
|
colorize(32)
|
|
|
|
end
|
|
|
|
|
|
|
|
def yellow
|
|
|
|
colorize(33)
|
|
|
|
end
|
|
|
|
|
|
|
|
def pink
|
|
|
|
colorize(35)
|
|
|
|
end
|
|
|
|
end
|