Skip to content
Open
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/1379.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add :attr:`Role.has_gradient` and :attr:`Role.is_holographic` properties to check whether a role has a gradient or is holographic.
20 changes: 20 additions & 0 deletions disnake/role.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,26 @@ def tertiary_color(self) -> Optional[Colour]:
"""
return self.tertiary_colour

@property
def has_gradient(self) -> bool:
"""Whether the role has a gradient.

.. versionadded:: 2.12

:return type: :class:`bool`
"""
return self.secondary_color is not None and self.tertiary_color is None

@property
def is_holographic(self) -> bool:
"""Whether the role is holographic.

.. versionadded:: 2.12

:return type: :class:`bool`
"""
return self.tertiary_color is not None

@property
def icon(self) -> Optional[Asset]:
"""Optional[:class:`Asset`]: Returns the role's icon asset, if available.
Expand Down
Loading