Class: AnsiColor::Rainbow

Inherits:
Object
  • Object
show all
Defined in:
lib/ansi_color/rainbow.rb

Instance Method Summary collapse

Constructor Details

#initializeRainbow

Returns a new instance of Rainbow.



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/ansi_color/rainbow.rb', line 3

def initialize
  puts "\n\n== build_open_tag FOREGROUND"
  FOREGROUND_COLORS.each do |fg_name, fg_code|
    open = Helpers::build_open_tag(:color => fg_name)
    print "#{open}#{fg_name}#{Helpers::reset}\n"
  end

  puts "\n\n== build_open_tag BACKGROUND"
  BACKGROUND_COLORS.each do |bg_name, bg_code|
    open = Helpers::build_open_tag(:background => bg_name)
    print "#{open}#{bg_name}#{Helpers::reset}\n"
  end

  puts "\n\n== build_open_tag FOREGROUND, BACKGROUND & EFFECT"
  FOREGROUND_COLORS.each do |fg_name, fg_code|
    BACKGROUND_COLORS.each do |bg_name, bg_code|
      open = Helpers::build_open_tag(:color => fg_name, :background => bg_name)
      print "#{open}#{fg_name} #{bg_name}#{Helpers::reset}\n"
      EFFECTS.each do |effect_name, effect_code|
        open = Helpers::build_open_tag(:color => fg_name, :background => bg_name, :effects => effect_name)
        print "#{open}#{fg_name} #{bg_name} #{effect_name}#{Helpers::reset}\n"
      end
      print "\n"
    end
  end
end