Sha256: c6ac8e5d806cefdbd4d54dd3e7d68d9802d6b640200d552e6ccef5f6602973f9

Contents?: true

Size: 1.18 KB

Versions: 14

Compression:

Stored size: 1.18 KB

Contents

# from stack overflow
class String
  # colorization
  def colorize(color_code);  "\e[#{color_code}m#{self}\e[0m"; end
  def light_blue;     "\e[36m#{self}\e[0m"; end
  def black;          "\e[30m#{self}\e[0m"; end
  def red;            "\e[31m#{self}\e[0m"; end
  def green;          "\e[32m#{self}\e[0m"; end
  def yellow;          "\e[33m#{self}\e[0m"; end
  def blue;           "\e[34m#{self}\e[0m"; end
  def magenta;        "\e[35m#{self}\e[0m"; end
  def cyan;           "\e[36m#{self}\e[0m"; end
  def gray;           "\e[37m#{self}\e[0m"; end

  def bg_black;       "\e[40m#{self}\e[0m"; end
  def bg_red;         "\e[41m#{self}\e[0m"; end
  def bg_green;       "\e[42m#{self}\e[0m"; end
  def bg_brown;       "\e[43m#{self}\e[0m"; end
  def bg_blue;        "\e[44m#{self}\e[0m"; end
  def bg_magenta;     "\e[45m#{self}\e[0m"; end
  def bg_cyan;        "\e[46m#{self}\e[0m"; end
  def bg_gray;        "\e[47m#{self}\e[0m"; end

  def bold;           "\e[1m#{self}\e[22m"; end
  def italic;         "\e[3m#{self}\e[23m"; end
  def underline;      "\e[4m#{self}\e[24m"; end
  def blink;          "\e[5m#{self}\e[25m"; end
  def reverse_color;  "\e[7m#{self}\e[27m"; end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
slight-lang-1.3.6 bin/repl/utils.rb
slight-lang-1.3.5 bin/repl/utils.rb
slight-lang-1.3.4 bin/repl/utils.rb
slight-lang-1.3.3 bin/repl/utils.rb
slight-lang-1.3.2 bin/repl/utils.rb
slight-lang-1.3.1 bin/repl/utils.rb
slight-lang-1.3.0 bin/repl/utils.rb
slight-lang-1.2.3 bin/repl/utils.rb
slight-lang-1.2.1.3 bin/repl/utils.rb
slight-lang-1.2.1.2 bin/repl/utils.rb
slight-lang-1.2.1.1 bin/repl/utils.rb
slight-lang-1.1.6 bin/repl/utils.rb
slight-lang-1.2.0 bin/repl/utils.rb
slight-lang-1.0.1 bin/repl/utils.rb