Sha256: 8a4f04b24738c21bde0415e2c197252b712301f1e9c55037da1e2c21ce2da7f4

Contents?: true

Size: 1.67 KB

Versions: 10

Compression:

Stored size: 1.67 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 '/tmp/colours.log'
    renderers(Vedeu::Renderers::Terminal.new,
              Vedeu::Renderers::File.new(filename: '/tmp/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(:top, :left, 50, 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.10 examples/dsl_colours.rb
vedeu-0.8.9 examples/dsl_colours.rb
vedeu-0.8.8 examples/dsl_colours.rb
vedeu-0.8.7 examples/dsl_colours.rb
vedeu-0.8.6 examples/dsl_colours.rb
vedeu-0.8.5 examples/dsl_colours.rb
vedeu-0.8.4 examples/dsl_colours.rb
vedeu-0.8.3 examples/dsl_colours.rb
vedeu-0.8.2 examples/dsl_colours.rb
vedeu-0.8.1 examples/dsl_colours.rb