Sha256: 581d0188ff3288c69054f39172db2a434ee1e1b3ee7ae706a9e79a3f02c79781

Contents?: true

Size: 800 Bytes

Versions: 7

Compression:

Stored size: 800 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 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

7 entries across 7 versions & 1 rubygems

Version Path
whirled_peas-0.9.1 screen_test/settings/ansi/color.rb
whirled_peas-0.9.0 screen_test/settings/ansi/color.rb
whirled_peas-0.8.0 screen_test/settings/ansi/color.rb
whirled_peas-0.7.1 screen_test/settings/ansi/color.rb
whirled_peas-0.7.0 screen_test/settings/ansi/color.rb
whirled_peas-0.6.0 screen_test/rendered/settings/ansi/color.rb
whirled_peas-0.5.0 screen_test/rendered/settings/ansi/color.rb