Class: Discordrb::ColourRGB

Inherits:
Object
  • Object
show all
Defined in:
lib/discordrb/data.rb

Overview

A colour (red, green and blue values). Used for role colours. If you prefer the American spelling, the alias ColorRGB is also available.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(combined) ⇒ ColourRGB

Make a new colour from the combined value.

Parameters:

  • combined (Integer)

    The colour's RGB values combined into one integer



1646
1647
1648
1649
1650
1651
# File 'lib/discordrb/data.rb', line 1646

def initialize(combined)
  @combined = combined
  @red = (combined >> 16) & 0xFF
  @green = (combined >> 8) & 0xFF
  @blue = combined & 0xFF
end

Instance Attribute Details

#blueInteger (readonly)

Returns the blue part of this colour (0-255).

Returns:

  • (Integer)

    the blue part of this colour (0-255).



1639
1640
1641
# File 'lib/discordrb/data.rb', line 1639

def blue
  @blue
end

#combinedInteger (readonly)

Returns the colour's RGB values combined into one integer.

Returns:

  • (Integer)

    the colour's RGB values combined into one integer.



1642
1643
1644
# File 'lib/discordrb/data.rb', line 1642

def combined
  @combined
end

#greenInteger (readonly)

Returns the green part of this colour (0-255).

Returns:

  • (Integer)

    the green part of this colour (0-255).



1636
1637
1638
# File 'lib/discordrb/data.rb', line 1636

def green
  @green
end

#redInteger (readonly)

Returns the red part of this colour (0-255).

Returns:

  • (Integer)

    the red part of this colour (0-255).



1633
1634
1635
# File 'lib/discordrb/data.rb', line 1633

def red
  @red
end