Parent

Methods

Sickill::Rainbow::AnsiColor

Retrieve ANSI color code from a color name, an html color or an RGB color

Public Class Methods

new(ground, *color) click to toggle source

ground is one of :foreground, :background color is one of this 3 formats: name, html, rgb

# File lib/ansi_color.rb, line 12
def initialize(ground, *color)
  @ground = ground

  if color.size == 1
    @color = color.first
  else
    @color = color
  end
end

Public Instance Methods

code() click to toggle source

Get the ANSI color code.

# File lib/ansi_color.rb, line 23
def code
  case @color
    when Symbol then code_from_name
    when String then code_from_html
    when Array then code_from_rgb
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.