# class Gdk::RGBA

### Public Class Methods

new(red=nil, green=nil, blue=nil, alpha=nil) click to toggle source

    # File lib/gdk3/rgba.rb, line 41
    def initialize(red=nil, green=nil, blue=nil, alpha=nil)
      initialize_raw
      self.red = red if red
      self.green = green if green
      self.blue = blue if blue
      self.alpha = alpha || 1.0
    end

Also aliased as: initialize_raw
parse(spec) click to toggle source

    # File lib/gdk3/rgba.rb, line 20
    def parse(spec)
      rgba = new
      unless rgba.parse(spec)
        available_formats = [
          "COLOR_NAME",
          "\#RGB",
          "\#RRGGBB",
          "\#RRRGGGBBB",
          "\#RRRRGGGGBBBB",
          "rgb(R, G, B)",
          "rgba(R, G, B, A)",
        ]
        message = "invalid RGBA format: #{spec.inspect} "
        message << "(available formats: #{available_formats.join(', ')})"
        raise ArgumentError, message
      end
      rgba
    end

### Public Instance Methods

initialize_raw(red=nil, green=nil, blue=nil, alpha=nil)
Alias for: new
to_a() click to toggle source

    # File lib/gdk3/rgba.rb, line 49
    def to_a
      [red, green, blue, alpha]
    end