Sha256: da7b736f224466128b48bf8a77348ab54806a6ed2569fabac973a6450bafe543

Contents?: true

Size: 1.01 KB

Versions: 3

Compression:

Stored size: 1.01 KB

Contents

#!/usr/bin/env ruby

lib_dir = File.dirname(__FILE__) + '/../lib'
$LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)

require 'vedeu'

# An example application to demonstrate colours.
#
# If you have cloned this repository from GitHub, you can run this example:
#
#     ./examples/colours_app.rb
#
class VedeuColoursApp

  Vedeu.bind(:_initialize_) { Vedeu.trigger(:_refresh_) }

  # Be aware that running an application with debugging enabled will affect
  # performance.
  Vedeu.configure do
    # debug!
    log '/tmp/vedeu_colours_app.log'
  end

  Vedeu.interface 'colours_256' do
    geometry do
      centred!
      height 16
      width  80
    end
  end

  Vedeu.renders do
    view('colours_256') do
      lines do
        0.upto(16) do |row|
          line do
            0.upto(15) do |column|
              code = (row * 15) + column
              right "#{code}", width: 5, background: code, foreground: '#ffffff'
            end
          end
        end
      end
    end
  end

end # VedeuColoursApp

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
vedeu-0.5.7 examples/colours_app.rb
vedeu-0.5.6 examples/colours_app.rb
vedeu-0.5.5 examples/colours_app.rb