Class: HighLine::ColorScheme

Class | HighLine::ColorScheme
In: | lib/highline/color_scheme.rb
Parent: | Object

ColorScheme objects encapsulate a named set of colors to be used in the HighLine.colors() method call. For example, by applying a ColorScheme that has a `:warning` color then the following could be used:

      colors("This is a warning", :warning)

A ColorScheme contains named sets of HighLine color constants.

Example: Instantiating a color scheme, applying it to HighLine,

             and using it:

      ft = HighLine::ColorScheme.new do |cs|
             cs[:headline]        = [ :bold, :yellow, :on_black ]
             cs[:horizontal_line] = [ :bold, :white ]
             cs[:even_row]        = [ :green ]
             cs[:odd_row]         = [ :magenta ]
           end

      HighLine.color_scheme = ft
      say("<%= color('Headline', :headline) %>")
      say("<%= color('-'*20, :horizontal_line) %>")
      i = true
      ("A".."D").each do |row|
         if i then
           say("<%= color('#{row}', :even_row ) %>")
         else
           say("<%= color('#{row}', :odd_row) %>")
         end
         i = !i
      end

### Methods

[] []= include? load_from_hash new

### Public Class methods

new( h = nil ) {|self if block_given?| ...}

Create an instance of HighLine::ColorScheme. The customization can happen as a passed in Hash or via the yielded block. Key‘s are converted to `:symbols` and values are converted to HighLine constants.

### Public Instance methods

[]( color_tag )

Allow the scheme to be accessed like a Hash.

[]=( color_tag, constants )

Allow the scheme to be set like a Hash.

include?( color_tag )

Does this color scheme include the given tag name?

load_from_hash( h )

Load multiple colors from key/value pairs.

[Validate]