Class RoleColors
java.lang.Object
net.dv8tion.jda.api.entities.RoleColors
- All Implemented Interfaces:
SerializableData
The colors of a
Role.
Roles can have up to three color components, and the appearance changes depending on how many components are configured.
- If a role has no configured colors, then it uses the default color of the current display theme in the client, which contrasts with the theme's background. (See
isDefault()) - If a role only has a primary color, it uses a solid color style. (See
isSolid()) - If a role has two configured colors with
getPrimary()andgetSecondary(), then it uses a gradient of the two colors. (SeeisGradient()) - If a role has three configured colors, it uses a holographic style instead. (See
isHolographic())
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final RoleColorsThe default colors used by a role.static final RoleColorsSentinel values used by Discord to indicate holographic style. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanThe primary color component of the role.intThe primary color component of the role.The secondary color component of the role.intThe secondary color component of the role.The tertiary color component of the role.intThe tertiary color component of the role.inthashCode()booleanWhether this role uses the default colors, which is determined by the client theme.booleanWhether this role uses gradient style.booleanWhether this role uses holographic style.booleanisSolid()Whether this role uses solid color style.toData()SerializedDataObjectfor this object.toString()
-
Field Details
-
DEFAULT_HOLOGRAPHIC
Sentinel values used by Discord to indicate holographic style.- See Also:
-
DEFAULT
The default colors used by a role. The display color is determined by the selected theme on each client.- See Also:
-
-
Constructor Details
-
RoleColors
public RoleColors(int primary, int secondary, int tertiary)
-
-
Method Details
-
isDefault
public boolean isDefault()Whether this role uses the default colors, which is determined by the client theme.- Returns:
- True, if the primary color is
Role.DEFAULT_COLOR_RAW
-
isSolid
public boolean isSolid()Whether this role uses solid color style.- Returns:
- True if only a primary color is configured.
-
isGradient
public boolean isGradient()Whether this role uses gradient style.- Returns:
- True if a secondary color is configured but no tertiary color.
-
isHolographic
public boolean isHolographic()Whether this role uses holographic style.- Returns:
- True, if the colors match
DEFAULT_HOLOGRAPHIC
-
getPrimary
The primary color component of the role.- Returns:
- Primary Color or
nullif the default color is used - See Also:
-
getPrimaryRaw
public int getPrimaryRaw()The primary color component of the role.- Returns:
- Primary Color as a raw RGB value or
Role.DEFAULT_COLOR_RAWif the default color is used - See Also:
-
getSecondary
-
getSecondaryRaw
public int getSecondaryRaw()The secondary color component of the role.This is only set for roles with gradient colors and only applied if the
Guildhas theENHANCED_ROLE_COLORSfeature enabled.- Returns:
- Secondary Color as a raw RGB value or
Role.DEFAULT_COLOR_RAWif this role has no gradient color - See Also:
-
getTertiary
-
getTertiaryRaw
public int getTertiaryRaw()The tertiary color component of the role.This is only set for roles with holographic style and only applied if the
Guildhas theENHANCED_ROLE_COLORSfeature enabled.- Returns:
- Tertiary Color as a raw RGB value or
Role.DEFAULT_COLOR_RAWif this role has no holographic style - See Also:
-
equals
-
hashCode
-
toString
-
toData
Description copied from interface:SerializableDataSerializedDataObjectfor this object.- Specified by:
toDatain interfaceSerializableData- Returns:
DataObject
-