Module: Coloring
- Defined in:
- lib/coloring.rb,
lib/coloring/version.rb
Constant Summary collapse
- SGRPARAMS =
Select Graphic Rendition parameters
{ :bright => 1, :underline => 4, :blink => 5, :negative => 7, :hide => 8, :black => 30, :red => 31, :green => 32, :yellow => 33, :blue => 34, :magenta => 35, :cyan => 36, :white => 37, :on_black => 40, :on_red => 41, :on_green => 42, :on_yellow => 43, :on_blue => 44, :on_magenta => 45, :on_cyan => 46, :on_white => 47 }
- VERSION =
"0.0.5"
Class Method Summary collapse
Instance Method Summary collapse
-
#coloring(params) ⇒ Object
Output method.
Class Method Details
.view_avaliable ⇒ Object
71 72 73 |
# File 'lib/coloring.rb', line 71 def view_avaliable SGRPARAMS.each { |key, value| puts "#{key}".coloring(value) + " > String.#{key}" } end |
Instance Method Details
#coloring(params) ⇒ Object
Output method
55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/coloring.rb', line 55 def coloring ( params ) if params.instance_of?(Array) all_params = params.map! { |elem| elem = self.set_param(elem).to_s }.join ";" else all_params = self.set_param( params ) end "\033[#{all_params}m" + self + "\033[0m" end |