Sha256: 5f259d9baf9b9329c7f9132bfbc670b0332a53a3e7138c1bbda1c96890176460

Contents?: true

Size: 978 Bytes

Versions: 20

Compression:

Stored size: 978 Bytes

Contents

#!/usr/bin/env ruby
# encoding: utf-8

# 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}) %>!")
  say("This should be <%= color('#{colors[i - 1]} on #{c}', \
      :#{colors[i - 1]}, :on_#{c} ) %>!")
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

20 entries across 19 versions & 3 rubygems

Version Path
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.1.0/gems/highline-3.1.1/examples/ansi_colors.rb
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.3.0/gems/highline-3.1.1/examples/ansi_colors.rb
highline-3.1.2 examples/ansi_colors.rb
highline-3.1.1 examples/ansi_colors.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/highline-3.0.1/examples/ansi_colors.rb
highline-3.1.0 examples/ansi_colors.rb
highline-3.0.1 examples/ansi_colors.rb
highline-3.0.0 examples/ansi_colors.rb
highline-3.0.0.pre.1 examples/ansi_colors.rb
highline-2.1.0 examples/ansi_colors.rb
highline-2.0.3 examples/ansi_colors.rb
highline-2.0.2 examples/ansi_colors.rb
highline-2.0.1 examples/ansi_colors.rb
highline-2.0.0 examples/ansi_colors.rb
highline-2.0.0.pre.develop.16 examples/ansi_colors.rb
highline-2.0.0.pre.develop.15 examples/ansi_colors.rb
highline-2.0.0.pre.develop.14 examples/ansi_colors.rb
highline-2.0.0.pre.develop.13 examples/ansi_colors.rb
highline-2.0.0.pre.develop.12 examples/ansi_colors.rb
highline-2.0.0.pre.develop.11 examples/ansi_colors.rb