Class: Rubygoo::GooColor

Inherits:
Object
  • Object
show all
Defined in:
lib/rubygoo/goo_color.rb

Overview

is an rbga color

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(r, g, b, a) ⇒ GooColor

Returns a new instance of GooColor.



8
9
10
# File 'lib/rubygoo/goo_color.rb', line 8

def initialize(r,g,b,a)
@r,@g,@b,@a = r,g,b,a 
end

Instance Attribute Details

#aObject

Returns the value of attribute a.



7
8
9
# File 'lib/rubygoo/goo_color.rb', line 7

def a
  @a
end

#bObject

Returns the value of attribute b.



7
8
9
# File 'lib/rubygoo/goo_color.rb', line 7

def b
  @b
end

#gObject

Returns the value of attribute g.



7
8
9
# File 'lib/rubygoo/goo_color.rb', line 7

def g
  @g
end

#rObject

Returns the value of attribute r.



7
8
9
# File 'lib/rubygoo/goo_color.rb', line 7

def r
  @r
end

Class Method Details

.color(color, alpha = nil) ⇒ Object



12
13
14
15
16
17
# File 'lib/rubygoo/goo_color.rb', line 12

def self.color(color, alpha=nil)
  c = COLORS[color]
  c ||= [0,0,0,255]
  c[3] = alpha if alpha
  GooColor.new *c
end