def color(color, str)
      raise "[BUG] Unrecognized color #{color}" unless COLORS[color]

      # Almost any real Unix terminal will support color,
      # so we just filter for Windows terms (which don't set TERM)
      # and not-real terminals, which aren't ttys.
      return str if ENV["TERM"].nil? || ENV["TERM"].empty? || !STDOUT.tty?
      "\e[#{COLORS[color]}m#{str}\e[0m"
    end
def color(color, str)
      raise "[BUG] Unrecognized color #{color}" unless COLORS[color]

      # Almost any real Unix terminal will support color,
      # so we just filter for Windows terms (which don't set TERM)
      # and not-real terminals, which aren't ttys.
      return str if ENV["TERM"].nil? || ENV["TERM"].empty? || !STDOUT.tty?
      "\e[#{COLORS[color]}m#{str}\e[0m"
    end
Wraps the given string in terminal escapes
 causing it to have the given color.
 If terminal escapes aren't supported on this platform,
 just returns the string instead.

 @param color [Symbol] The name of the color to use.
   Can be `:red`, `:green`, or `:yellow`.
 @param str [String] The string to wrap in the given color.
 @return [String] The wrapped string.