Sha256: 65aa98cfde310a95b5387b5f4f8e41f1b54ca47bda8c922168d4f70d2efa8cbe

Contents?: true

Size: 807 Bytes

Versions: 5

Compression:

Stored size: 807 Bytes

Contents

require 'whirled_peas'

class TemplateFactory
  COLORS = %i[
    black
    gray
    red
    green
    yellow
    blue
    magenta
    cyan
    white
    bright_red
    bright_green
    bright_yellow
    bright_blue
    bright_magenta
    bright_cyan
    bright_white
  ]
  def build(*)
    WhirledPeas.template(:test) do |composer|
      composer.add_grid('Colors') do |composer, settings|
        settings.num_cols = 1
        COLORS.each.with_index do |color, index|
          bg_color = COLORS[(index + COLORS.length / 2) % COLORS.length]
          composer.add_text("#{color.upcase}-#{bg_color.upcase}") do |_, settings|
            settings.color = color
            settings.bg_color = bg_color
            "#{color.upcase} on #{bg_color.upcase}"
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
whirled_peas-0.13.0 screen_test/settings/ansi/color.rb
whirled_peas-0.12.0 screen_test/settings/ansi/color.rb
whirled_peas-0.11.1 screen_test/settings/ansi/color.rb
whirled_peas-0.11.0 screen_test/settings/ansi/color.rb
whirled_peas-0.10.0 screen_test/settings/ansi/color.rb