Class: Discordrb::ColourRGB
- Inherits:
-
Object
- Object
- Discordrb::ColourRGB
- 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
-
#blue ⇒ Integer
readonly
The blue part of this colour (0-255).
-
#combined ⇒ Integer
readonly
The colour's RGB values combined into one integer.
-
#green ⇒ Integer
readonly
The green part of this colour (0-255).
-
#red ⇒ Integer
readonly
The red part of this colour (0-255).
Instance Method Summary collapse
-
#initialize(combined) ⇒ ColourRGB
constructor
Make a new colour from the combined value.
Constructor Details
#initialize(combined) ⇒ ColourRGB
Make a new colour from the combined value.
2741 2742 2743 2744 2745 2746 |
# File 'lib/discordrb/data.rb', line 2741 def initialize(combined) @combined = combined @red = (combined >> 16) & 0xFF @green = (combined >> 8) & 0xFF @blue = combined & 0xFF end |
Instance Attribute Details
#blue ⇒ Integer (readonly)
Returns the blue part of this colour (0-255).
2734 2735 2736 |
# File 'lib/discordrb/data.rb', line 2734 def blue @blue end |
#combined ⇒ Integer (readonly)
Returns the colour's RGB values combined into one integer.
2737 2738 2739 |
# File 'lib/discordrb/data.rb', line 2737 def combined @combined end |
#green ⇒ Integer (readonly)
Returns the green part of this colour (0-255).
2731 2732 2733 |
# File 'lib/discordrb/data.rb', line 2731 def green @green end |
#red ⇒ Integer (readonly)
Returns the red part of this colour (0-255).
2728 2729 2730 |
# File 'lib/discordrb/data.rb', line 2728 def red @red end |