Sha256: c407536c6549d4e9435d70618e073e3fd6ffef606ca7055672736fcf95eb566f

Contents?: true

Size: 1.08 KB

Versions: 144

Compression:

Stored size: 1.08 KB

Contents

#!/usr/local/bin/ruby -w

# ansi_colors.rb
#
#  Created by James Edward Gray II on 2005-05-03.
#  Copyright 2005 Gray Productions. All rights reserved.

require "rubygems"
require "highline/import"

# Supported color sequences.
colors = %w{black red green yellow blue magenta cyan white}

# Using color() with symbols.
colors.each_with_index do |c, i|
  say("This should be <%= color('#{c}', :#{c}) %>!")
  if i == 0
    say( "This should be " +
         "<%= color('white on #{c}', :white, :on_#{c}) %>!")
  else
    say( "This should be " +
         "<%= color( '#{colors[i - 1]} on #{c}',
                     :#{colors[i - 1]}, :on_#{c} ) %>!")
  end
end

# Using color with constants.
say("This should be <%= color('bold', BOLD) %>!")
say("This should be <%= color('underlined', UNDERLINE) %>!")

# Using constants only.
say("This might even <%= BLINK %>blink<%= CLEAR %>!")

# It even works with list wrapping.
erb_digits = %w{Zero One Two Three Four}      +
             ["<%= color('Five', :blue) %%>"] +
             %w{Six Seven Eight Nine}
say("<%= list(#{erb_digits.inspect}, :columns_down, 3) %>")

Version data entries

144 entries across 140 versions & 15 rubygems

Version Path
radiant-0.9.0.rc2 vendor/highline/examples/ansi_colors.rb
middleman-0.13.1 lib/middleman/vendor/gems/ruby/1.9.1/gems/highline-1.5.1/examples/ansi_colors.rb
middleman-0.13.1 lib/middleman/vendor/gems/ruby/1.8/gems/highline-1.5.1/examples/ansi_colors.rb
highline-1.5.2 examples/ansi_colors.rb
middleman-0.12.2 lib/middleman/vendor/gems/gems/highline-1.5.1/examples/ansi_colors.rb
middleman-0.12.1 lib/middleman/vendor/gems/gems/highline-1.5.1/examples/ansi_colors.rb
ginst-2009.12.8 vendor/gems/highline-1.5.0/examples/ansi_colors.rb
middleman-0.12.0.pre3 lib/middleman/vendor/gems/gems/highline-1.5.1/examples/ansi_colors.rb
middleman-0.12.0.pre2 lib/middleman/vendor/gems/gems/highline-1.5.1/examples/ansi_colors.rb
middleman-0.12.0.pre lib/middleman/vendor/gems/gems/highline-1.5.1/examples/ansi_colors.rb
ginst-2009.11.24 vendor/gems/highline-1.5.0/examples/ansi_colors.rb
ginst-2009.11.23 vendor/gems/highline-1.5.0/examples/ansi_colors.rb
middleman-0.10.17 vendor/gems/gems/highline-1.5.1/examples/ansi_colors.rb
middleman-0.10.16 vendor/gems/gems/highline-1.5.1/examples/ansi_colors.rb
middleman-0.10.15 vendor/gems/gems/highline-1.5.1/examples/ansi_colors.rb
middleman-0.10.14 vendor/gems/gems/highline-1.5.1/examples/ansi_colors.rb
ginst-2.0.1 vendor/gems/highline-1.5.0/examples/ansi_colors.rb
ginst-2.0.0 vendor/gems/highline-1.5.0/examples/ansi_colors.rb
radiant-rc-0.9.0 vendor/highline/examples/ansi_colors.rb
radiant-0.8.1 vendor/highline/examples/ansi_colors.rb