Sha256: e32eb4369e98a1810853ea574cb980c69ee3678720eadec8fc4d5b2c25a34a91

Contents?: true

Size: 1.22 KB

Versions: 8

Compression:

Stored size: 1.22 KB

Contents

# frozen_string_literal: true

# encoding=utf-8

# │0  │ to restore default    │
# │   │ color                 │
# ├───┼───────────────────────┤
# │   │                       │
# │1  │ for brighter colors   │
# ├───┼───────────────────────┤
# │   │                       │
# │4  │ for underlined text   │
# ├───┼───────────────────────┤
# │   │                       │
# │5  │ for flashing text
class String
  def plain
    self
  end

  def black
    "\033[30m#{self}\033[0m"
  end

  def red
    "\033[31m#{self}\033[0m"
  end

  def bred
    "\033[1;31m#{self}\033[0m"
  end

  def green
    "\033[32m#{self}\033[0m"
  end

  def bgreen
    "\033[1;32m#{self}\033[0m"
  end

  def yellow
    "\033[33m#{self}\033[0m"
  end

  def byellow
    "\033[1;33m#{self}\033[0m"
  end

  def blue
    "\033[34m#{self}\033[0m"
  end

  def magenta
    "\033[35m#{self}\033[0m"
  end

  def cyan
    "\033[36m#{self}\033[0m"
  end

  def white
    "\033[37m#{self}\033[0m"
  end

  def bwhite
    "\033[1;37m#{self}\033[0m"
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
markdown_exec-1.3.8 lib/colorize.rb
markdown_exec-1.3.7 lib/colorize.rb
markdown_exec-1.3.6 lib/colorize.rb
markdown_exec-1.3.3.5 lib/colorize.rb
markdown_exec-1.3.3.4 lib/colorize.rb
markdown_exec-1.3.3.3 lib/colorize.rb
markdown_exec-1.3.3.2 lib/colorize.rb
markdown_exec-1.3.3.1 lib/colorize.rb