Class: Color

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#aObject

Returns the value of attribute a

Returns:

  • (Object)

    the current value of a



1
2
3
# File 'lib/color.rb', line 1

def a
  @a
end

#bObject

Returns the value of attribute b

Returns:

  • (Object)

    the current value of b



1
2
3
# File 'lib/color.rb', line 1

def b
  @b
end

#gObject

Returns the value of attribute g

Returns:

  • (Object)

    the current value of g



1
2
3
# File 'lib/color.rb', line 1

def g
  @g
end

#rObject

Returns the value of attribute r

Returns:

  • (Object)

    the current value of r



1
2
3
# File 'lib/color.rb', line 1

def r
  @r
end

Instance Method Details

#rgbObject



2
3
4
# File 'lib/color.rb', line 2

def rgb
  [r, g, b]
end

#rgba_formatObject



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

def rgba_format
  "rgba(" + (rgb.map(&:percentify) << a.value).join(", ") + ")"
end