Sha256: 589833a8a20f582377aa0199452a18640432753d3e692a3a28eb9dd5736ba755

Contents?: true

Size: 1.08 KB

Versions: 83

Compression:

Stored size: 1.08 KB

Contents

#!/usr/bin/env ruby

# 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

83 entries across 73 versions & 11 rubygems

Version Path
brakeman-3.3.5 bundle/ruby/2.3.0/gems/highline-1.7.8/examples/ansi_colors.rb
brakeman-3.3.4 bundle/ruby/2.3.0/gems/highline-1.7.8/examples/ansi_colors.rb
brakeman-3.3.3 bundle/ruby/2.3.0/gems/highline-1.7.8/examples/ansi_colors.rb
windows-pr-1.2.5 vendor/bundle/ruby/2.2.0/gems/win32-api-1.6.0-universal-mingw32/vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/ansi_colors.rb
brakeman-3.3.2 bundle/ruby/2.3.0/gems/highline-1.7.8/examples/ansi_colors.rb
win32-api-1.6.0-universal-mingw32 vendor/bundle/ruby/2.2.0/gems/highline-1.7.8/examples/ansi_colors.rb
brakeman-3.3.1 bundle/ruby/2.3.0/gems/highline-1.7.8/examples/ansi_colors.rb
brakeman-3.3.0 bundle/ruby/2.3.0/gems/highline-1.7.8/examples/ansi_colors.rb
highline-2.0.0.pre.develop.6 examples/ansi_colors.rb
highline-2.0.0.pre.develop.4 examples/ansi_colors.rb
highline-2.0.0.pre.develop.2 examples/ansi_colors.rb
highline-1.7.8 examples/ansi_colors.rb
highline-1.7.7 examples/ansi_colors.rb
highline-1.7.6 examples/ansi_colors.rb
highline-1.7.5 examples/ansi_colors.rb
highline-1.7.3 examples/ansi_colors.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/highline-1.6.21/examples/ansi_colors.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/highline-1.6.21/examples/ansi_colors.rb
scoot-0.0.4 .bundle/gems/ruby/2.2.0/gems/highline-1.7.2/examples/ansi_colors.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/highline-1.6.21/examples/ansi_colors.rb