Sha256: 207423b113258488874bcddfb52c739ae24861d094f4c8f22e230948a9f6af52

Contents?: true

Size: 1.72 KB

Versions: 10

Compression:

Stored size: 1.72 KB

Contents

#!/usr/bin/env ruby

# frozen_string_literal: true

require 'bundler/setup'
require 'vedeu'

class ColoursApp

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

  Vedeu.configure do
    debug!
    log Dir.tmpdir + '/colours.log'
    renderers(Vedeu::Renderers::Terminal.new,
              Vedeu::Renderers::Text.new(filename: Dir.tmpdir + '/colours.out'))
  end

  Vedeu.interface :interface_colours_view do
    colour background: '#550000', foreground: '#aaaa00'

    border do
      background '#673ab7'
      foreground '#ff9800'
      title 'Interface Colours'
    end
    geometry do
      align vertical: :top, horizontal: :left, width: 50, height: 20
    end
  end

  Vedeu.keymap '_global_' do
    key('q') { Vedeu.exit }
  end

  Vedeu.render do
    view(:interface_colours_view) do
      # line "test" - does not work, (wrong number of args for lines dsl/view.rb:240)

      lines do
        line "A line using interface colours."
        line ""
        line do
          stream do
            text "Stream { "
            text "background", background: '#001177'
            text " }"
          end
        end
        line do
          stream do
            text "Stream { "
            text "foreground", foreground: '#aa00ff'
            text " }"
          end
        end
        line do
          stream do
            text "Stream { "
            text "background", background: '#117700'
            text " }"
          end
        end
        line do
          stream do
            text "Stream { "
            text "foreground", foreground: '#00aaff'
            text " }"
          end
        end
      end
    end
  end

  def self.start(argv = ARGV)
    Vedeu::Launcher.execute!(argv)
  end

end # ColoursApp

ColoursApp.start

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
vedeu-0.8.31 examples/dsl_colours.rb
vedeu-0.8.30 examples/dsl_colours.rb
vedeu-0.8.29 examples/dsl_colours.rb
vedeu-0.8.28 examples/dsl_colours.rb
vedeu-0.8.27 examples/dsl_colours.rb
vedeu-0.8.26 examples/dsl_colours.rb
vedeu-0.8.25 examples/dsl_colours.rb
vedeu-0.8.24 examples/dsl_colours.rb
vedeu-0.8.23 examples/dsl_colours.rb
vedeu-0.8.22 examples/dsl_colours.rb