module Stripe::Util
def self.colorize(val, color, isatty)
Uses an ANSI escape code to colorize text if it's going to be sent to a
def self.colorize(val, color, isatty) return val unless isatty mode = 0 # default foreground = 30 + COLOR_CODES.fetch(color) background = 40 + COLOR_CODES.fetch(:default) "\033[#{mode};#{foreground};#{background}m#{val}\033[0m" end