mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-07-01 07:40:07 +00:00
Add colours for new Discord themes
This commit is contained in:
parent
680fe9bc80
commit
e84edf473c
@ -21,6 +21,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import colorsys
|
||||
@ -457,20 +458,59 @@ class Colour:
|
||||
"""
|
||||
return cls(0x99AAB5)
|
||||
|
||||
@classmethod
|
||||
def ash_theme(cls) -> Self:
|
||||
"""A factory method that returns a :class:`Colour` with a value of ``0x2E2E34``.
|
||||
|
||||
This will appear transparent on Discord's ash theme.
|
||||
|
||||
.. colour:: #2E2E34
|
||||
|
||||
.. versionadded:: 2.6
|
||||
"""
|
||||
return cls(0x2E2E34)
|
||||
|
||||
@classmethod
|
||||
def dark_theme(cls) -> Self:
|
||||
"""A factory method that returns a :class:`Colour` with a value of ``0x313338``.
|
||||
"""A factory method that returns a :class:`Colour` with a value of ``0x1A1A1E``.
|
||||
|
||||
This will appear transparent on Discord's dark theme.
|
||||
|
||||
.. colour:: #313338
|
||||
.. colour:: #1A1A1E
|
||||
|
||||
.. versionadded:: 1.5
|
||||
|
||||
.. versionchanged:: 2.2
|
||||
Updated colour from previous ``0x36393F`` to reflect discord theme changes.
|
||||
|
||||
.. versionchanged:: 2.6
|
||||
Updated colour from previous ``0x313338`` to reflect discord theme changes.
|
||||
"""
|
||||
return cls(0x313338)
|
||||
return cls(0x1A1A1E)
|
||||
|
||||
@classmethod
|
||||
def onyx_theme(cls) -> Self:
|
||||
"""A factory method that returns a :class:`Colour` with a value of ``0x070709``.
|
||||
|
||||
This will appear transparent on Discord's onyx theme.
|
||||
|
||||
.. colour:: #070709
|
||||
|
||||
.. versionadded:: 2.6
|
||||
"""
|
||||
return cls(0x070709)
|
||||
|
||||
@classmethod
|
||||
def light_theme(cls) -> Self:
|
||||
"""A factory method that returns a :class:`Colour` with a value of ``0xFBFBFB``.
|
||||
|
||||
This will appear transparent on Discord's light theme.
|
||||
|
||||
.. colour:: #FBFBFB
|
||||
|
||||
.. versionadded:: 2.6
|
||||
"""
|
||||
return cls(0xFBFBFB)
|
||||
|
||||
@classmethod
|
||||
def fuchsia(cls) -> Self:
|
||||
@ -493,24 +533,51 @@ class Colour:
|
||||
return cls(0xFEE75C)
|
||||
|
||||
@classmethod
|
||||
def dark_embed(cls) -> Self:
|
||||
"""A factory method that returns a :class:`Colour` with a value of ``0x2B2D31``.
|
||||
def ash_embed(cls) -> Self:
|
||||
"""A factory method that returns a :class:`Colour` with a value of ``0x37373E``.
|
||||
|
||||
.. colour:: #2B2D31
|
||||
.. colour:: #37373E
|
||||
|
||||
.. versionadded:: 2.6
|
||||
|
||||
"""
|
||||
return cls(0x37373E)
|
||||
|
||||
@classmethod
|
||||
def dark_embed(cls) -> Self:
|
||||
"""A factory method that returns a :class:`Colour` with a value of ``0x242429``.
|
||||
|
||||
.. colour:: #242429
|
||||
|
||||
.. versionadded:: 2.2
|
||||
|
||||
.. versionchanged:: 2.6
|
||||
Updated colour from previous ``0x2B2D31`` to reflect discord theme changes.
|
||||
"""
|
||||
return cls(0x2B2D31)
|
||||
return cls(0x242429)
|
||||
|
||||
@classmethod
|
||||
def onyx_embed(cls) -> Self:
|
||||
"""A factory method that returns a :class:`Colour` with a value of ``0x131416``.
|
||||
|
||||
.. colour:: #131416
|
||||
|
||||
.. versionadded:: 2.6
|
||||
"""
|
||||
return cls(0x131416)
|
||||
|
||||
@classmethod
|
||||
def light_embed(cls) -> Self:
|
||||
"""A factory method that returns a :class:`Colour` with a value of ``0xEEEFF1``.
|
||||
"""A factory method that returns a :class:`Colour` with a value of ``0xFFFFFF``.
|
||||
|
||||
.. colour:: #EEEFF1
|
||||
|
||||
.. versionadded:: 2.2
|
||||
|
||||
.. versionchanged:: 2.6
|
||||
Updated colour from previous ``0xEEEFF1`` to reflect discord theme changes.
|
||||
"""
|
||||
return cls(0xEEEFF1)
|
||||
return cls(0xFFFFFF)
|
||||
|
||||
@classmethod
|
||||
def pink(cls) -> Self:
|
||||
|
@ -106,11 +106,16 @@ def test_from_str_failures(value):
|
||||
(discord.Colour.og_blurple(), 0x7289DA),
|
||||
(discord.Colour.blurple(), 0x5865F2),
|
||||
(discord.Colour.greyple(), 0x99AAB5),
|
||||
(discord.Colour.dark_theme(), 0x313338),
|
||||
(discord.Colour.ash_theme(), 0x2E2E34),
|
||||
(discord.Colour.dark_theme(), 0x1A1A1E),
|
||||
(discord.Colour.onyx_theme(), 0x070709),
|
||||
(discord.Colour.light_theme(), 0xFBFBFB),
|
||||
(discord.Colour.fuchsia(), 0xEB459E),
|
||||
(discord.Colour.yellow(), 0xFEE75C),
|
||||
(discord.Colour.dark_embed(), 0x2B2D31),
|
||||
(discord.Colour.light_embed(), 0xEEEFF1),
|
||||
(discord.Colour.ash_embed(), 0x37373E),
|
||||
(discord.Colour.dark_embed(), 0x242429),
|
||||
(discord.Colour.onyx_embed(), 0x131416),
|
||||
(discord.Colour.light_embed(), 0xFFFFFF),
|
||||
(discord.Colour.pink(), 0xEB459F),
|
||||
],
|
||||
)
|
||||
@ -118,8 +123,6 @@ def test_static_colours(value, expected):
|
||||
assert value.value == expected
|
||||
|
||||
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
('value', 'property', 'expected'),
|
||||
[
|
||||
|
Loading…
x
Reference in New Issue
Block a user