Class: AnsiShowcase::Task

Inherits:
Thor
  • Object
show all
Defined in:
lib/ansi-showcase.rb

Constant Summary collapse

SHADES =
[ 
  [ :black, :dark ],
  [ :white, :intense_white, :bold ],
  [ :magenta, :intense_magenta, [ :bold, :magenta] ],
  [ :blue, :intense_blue, [ :bold, :blue] ],
  [ :cyan, :intense_cyan, [ :bold, :cyan] ],
  [ :green, :intense_green, [ :bold, :green] ],
  [ :yellow, :intense_yellow, [ :bold, :yellow] ],
  [ :red, :intense_red, [ :bold, :red ] ]
]
EFFECTS =
[
  [ :italic, :underline, :underscore ],
  [ :blink, :rapid_blink, :concealed ],
  [ :strikethrough ]
]
BACKGROUNDS =
[
  [ :on_black ],
  [ :on_white, :on_intense_white, ],
  [ :on_magenta, :on_intense_magenta, ],
  [ :on_blue, :on_intense_blue ],
  [ :on_green, :on_intense_green ],
  [ :on_yellow, :on_intense_yellow ],
  [ :on_red, :on_intense_red ]
]
NEGATIVES =
[
  [ :negative, [ :negative, :bold ], [ :negative, :underline ] ],
  [ [ :negative, :black ], [ :negative, :dark ] ],
  [ [ :negative, :blue ], [ :negative, :intense_blue ], [ :negative, :blue, :bold ] ],
  [ [ :negative, :underline ] ],
  [ [ :negative, :red, :on_blue ], [ :negative, :on_green ] ], 
  [ [ :negative, :on_intense_yellow ] ]
]

Instance Method Summary collapse

Instance Method Details

#allObject



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/ansi-showcase.rb', line 85

def all
  puts
  puts "  This is a brief showcase featuring the names of the methods in the "
  puts "  " + "Term::ANSIColor".intense_white + " (term-ansicolor) Ruby Gem for easy coloring using "
  puts "  escape sequences on ANSI terminals."
  puts
  puts "  For more information about term-ansicolor, visit the documentation on "
  puts "  http://github.com/flori/term-ansicolor"
  puts
  puts "  Keep in mind that many of the effects might be unsupported.".intense_white
  puts "  Support varies a lot between terminals and platforms."
  invoke :shades
  invoke :effects
  invoke :backgrounds
  invoke :negatives
  puts "  For a full list of options type: " + "ansi-showcase help".intense_white
  puts
end

#backgroundsObject



66
67
68
69
70
71
# File 'lib/ansi-showcase.rb', line 66

def backgrounds
  puts 
  puts "  Backgrounds:"
  puts
  say_palette BACKGROUNDS
end

#effectsObject



58
59
60
61
62
63
# File 'lib/ansi-showcase.rb', line 58

def effects
  puts
  puts "  Effects:"
  puts
  say_palette EFFECTS
end

#negativesObject



74
75
76
77
78
79
80
81
82
# File 'lib/ansi-showcase.rb', line 74

def negatives
  puts 
  puts "  Negatives:"
  puts "  Several combinations of the negative (reverse) effect with other"
  puts "  effects are shown in order to make it easy to grasp what it does,"
  puts "  because is not self-evident."
  puts
  say_palette NEGATIVES
end

#shadesObject



50
51
52
53
54
55
# File 'lib/ansi-showcase.rb', line 50

def shades
  puts
  puts "  Shades: "
  puts
  say_palette SHADES
end