Class RgbColor Stay organized with collections Save and categorize content based on your preferences.
Page Summary
RgbColor defines a color using red, green, and blue channels.
You can get the hexadecimal string representation of the color using asHexString().
You can retrieve the individual red, green, and blue channel values (0-255) using getRed(), getGreen(), and getBlue().
The type of the color can be obtained using getColorType().
A color defined by red, green, blue color channels.
Methods
| Method | Return type | Brief description |
|---|---|---|
as | String | Returns the color as a CSS-style 7 character hexadecimal string (#rrggbb) or 9 characterhexadecimal string (#aarrggbb). |
get | Integer | The blue channel of this color, as a number from 0 to 255. |
get | Color | Get the type of this color. |
get | Integer | The green channel of this color, as a number from 0 to 255. |
get | Integer | The red channel of this color, as a number from 0 to 255. |
Detailed documentation
asHexString()
Returns the color as a CSS-style 7 character hexadecimal string (#rrggbb) or 9 characterhexadecimal string (#aarrggbb).
Return
String — The hex representation of color.
getBlue()
The blue channel of this color, as a number from 0 to 255.
Return
Integer — The value of blue channel.
getColorType()
getGreen()
The green channel of this color, as a number from 0 to 255.
Return
Integer — The value of green channel.
getRed()
The red channel of this color, as a number from 0 to 255.
Return
Integer — The value of red channel.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-12-11 UTC.