Class: Zerenity::ColorSelection

Inherits:
Base
  • Object
show all
Defined in:
lib/zerenity/colorselection.rb

Overview

:nodoc:

Class Method Summary collapse

Methods inherited from Base

build, check, retrieve_selection

Class Method Details

.run(options) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/zerenity/colorselection.rb', line 15

def self.run( options )
  self.check( options )
  Gtk.init
  color_selection = Gtk::ColorSelectionDialog.new( options[ :title ])
  result = nil
  color_selection.run do |response|
    if ( response == Gtk::Dialog::RESPONSE_OK )
      # I don't have the latest Ruby/GNOME2 on my system so this mimics current_color.to_s
      result = "##{ color_selection.colorsel.current_color.to_a.map{|channel| channel.to_s(16).rjust(4,'0').upcase }.join }"
    end
  end
  color_selection.destroy
  return result
end