Sha256: ef3b21546278120c1b86e152c7e20e9d520de5406aa90779332ad92dfa446f4b

Contents?: true

Size: 1.31 KB

Versions: 3

Compression:

Stored size: 1.31 KB

Contents

require 'bundler/setup'
require 'whirled_peas'

class TemplateFactory
  TITLE_FONT = :default #roman
  PRIMARY_COLOR = :bright_blue
  SECONDARY_COLOR = :blue
  BG_COLOR = :bright_white

  def build(name, args)
    WhirledPeas.template do |composer, settings|
      settings.set_padding(left: 10, top: 6, right: 10, bottom: 6)
      settings.align = :center
      settings.width = 120
      settings.flow = :t2b
      settings.bold = true
      settings.bg_color = BG_COLOR

      composer.add_box do |composer, settings|
        composer.add_text do |_, settings|
          settings.title_font = TITLE_FONT
          settings.color = PRIMARY_COLOR
          'Visualize'
        end
      end
      composer.add_box do |_, settings|
        settings.set_margin(top: 1)
        settings.color = SECONDARY_COLOR
        "your code's execution with"
      end
      composer.add_box do |composer, settings|
        settings.set_margin(top: 1)
        composer.add_text do |_, settings|
          settings.title_font = TITLE_FONT
          settings.color = PRIMARY_COLOR
          'Whirled Peas'
        end
      end
    end
  end
end

class Driver
  def start(producer)
    producer.send_frame('intro', duration: 5)
  end
end

WhirledPeas.configure do |config|
  config.template_factory = TemplateFactory.new
  config.driver = Driver.new
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
whirled_peas-0.7.1 examples/intro.rb
whirled_peas-0.7.0 examples/intro.rb
whirled_peas-0.6.0 examples/intro.rb