Class: Graphit::Color

Inherits:
Object
  • Object
show all
Defined in:
lib/graphit/color.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(red, green, blue) ⇒ Color

Returns a new instance of Color.



9
10
11
12
13
# File 'lib/graphit/color.rb', line 9

def initialize( red, green, blue )
  self.red   = red
  self.green = green
  self.blue  = blue
end

Instance Attribute Details

#blueObject

Returns the value of attribute blue.



7
8
9
# File 'lib/graphit/color.rb', line 7

def blue
  @blue
end

#greenObject

Returns the value of attribute green.



6
7
8
# File 'lib/graphit/color.rb', line 6

def green
  @green
end

#redObject

0 - 255



5
6
7
# File 'lib/graphit/color.rb', line 5

def red
  @red
end

Class Method Details

.black_colorObject



35
36
37
# File 'lib/graphit/color.rb', line 35

def self.black_color
  Graphit::Color.new( 0, 0, 0 )
end

.blue_colorObject



43
44
45
# File 'lib/graphit/color.rb', line 43

def self.blue_color
  Graphit::Color.new( 0, 0, 255 )
end

.green_colorObject



47
48
49
# File 'lib/graphit/color.rb', line 47

def self.green_color
  Graphit::Color.new( 0, 255, 0 )
end

.light_gray_colorObject



23
24
25
# File 'lib/graphit/color.rb', line 23

def self.light_gray_color
  Graphit::Color.new( 204, 204, 204 )
end

.light_light_gray_colorObject



19
20
21
# File 'lib/graphit/color.rb', line 19

def self.light_light_gray_color
  Graphit::Color.new( 225, 225, 225 )
end

.medium_gray_colorObject



27
28
29
# File 'lib/graphit/color.rb', line 27

def self.medium_gray_color
  Graphit::Color.new( 170, 170, 170 )
end

.red_colorObject



39
40
41
# File 'lib/graphit/color.rb', line 39

def self.red_color
  Graphit::Color.new( 255, 0, 0 )
end

.white_colorObject



31
32
33
# File 'lib/graphit/color.rb', line 31

def self.white_color
  Graphit::Color.new( 255, 255, 255 )
end

Instance Method Details

#to_hex_arrayObject



15
16
17
# File 'lib/graphit/color.rb', line 15

def to_hex_array
  [blue,green,red]
end