Skip to content

Commit e84edf4

Browse files
authored
Add colours for new Discord themes
1 parent 680fe9b commit e84edf4

File tree

2 files changed

+83
-13
lines changed

2 files changed

+83
-13
lines changed

discord/colour.py

Lines changed: 75 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
2222
DEALINGS IN THE SOFTWARE.
2323
"""
24+
2425
from __future__ import annotations
2526

2627
import colorsys
@@ -457,20 +458,59 @@ def greyple(cls) -> Self:
457458
"""
458459
return cls(0x99AAB5)
459460

461+
@classmethod
462+
def ash_theme(cls) -> Self:
463+
"""A factory method that returns a :class:`Colour` with a value of ``0x2E2E34``.
464+
465+
This will appear transparent on Discord's ash theme.
466+
467+
.. colour:: #2E2E34
468+
469+
.. versionadded:: 2.6
470+
"""
471+
return cls(0x2E2E34)
472+
460473
@classmethod
461474
def dark_theme(cls) -> Self:
462-
"""A factory method that returns a :class:`Colour` with a value of ``0x313338``.
475+
"""A factory method that returns a :class:`Colour` with a value of ``0x1A1A1E``.
463476
464477
This will appear transparent on Discord's dark theme.
465478
466-
.. colour:: #313338
479+
.. colour:: #1A1A1E
467480
468481
.. versionadded:: 1.5
469482
470483
.. versionchanged:: 2.2
471484
Updated colour from previous ``0x36393F`` to reflect discord theme changes.
485+
486+
.. versionchanged:: 2.6
487+
Updated colour from previous ``0x313338`` to reflect discord theme changes.
472488
"""
473-
return cls(0x313338)
489+
return cls(0x1A1A1E)
490+
491+
@classmethod
492+
def onyx_theme(cls) -> Self:
493+
"""A factory method that returns a :class:`Colour` with a value of ``0x070709``.
494+
495+
This will appear transparent on Discord's onyx theme.
496+
497+
.. colour:: #070709
498+
499+
.. versionadded:: 2.6
500+
"""
501+
return cls(0x070709)
502+
503+
@classmethod
504+
def light_theme(cls) -> Self:
505+
"""A factory method that returns a :class:`Colour` with a value of ``0xFBFBFB``.
506+
507+
This will appear transparent on Discord's light theme.
508+
509+
.. colour:: #FBFBFB
510+
511+
.. versionadded:: 2.6
512+
"""
513+
return cls(0xFBFBFB)
474514

475515
@classmethod
476516
def fuchsia(cls) -> Self:
@@ -492,25 +532,52 @@ def yellow(cls) -> Self:
492532
"""
493533
return cls(0xFEE75C)
494534

535+
@classmethod
536+
def ash_embed(cls) -> Self:
537+
"""A factory method that returns a :class:`Colour` with a value of ``0x37373E``.
538+
539+
.. colour:: #37373E
540+
541+
.. versionadded:: 2.6
542+
543+
"""
544+
return cls(0x37373E)
545+
495546
@classmethod
496547
def dark_embed(cls) -> Self:
497-
"""A factory method that returns a :class:`Colour` with a value of ``0x2B2D31``.
548+
"""A factory method that returns a :class:`Colour` with a value of ``0x242429``.
498549
499-
.. colour:: #2B2D31
550+
.. colour:: #242429
500551
501552
.. versionadded:: 2.2
553+
554+
.. versionchanged:: 2.6
555+
Updated colour from previous ``0x2B2D31`` to reflect discord theme changes.
556+
"""
557+
return cls(0x242429)
558+
559+
@classmethod
560+
def onyx_embed(cls) -> Self:
561+
"""A factory method that returns a :class:`Colour` with a value of ``0x131416``.
562+
563+
.. colour:: #131416
564+
565+
.. versionadded:: 2.6
502566
"""
503-
return cls(0x2B2D31)
567+
return cls(0x131416)
504568

505569
@classmethod
506570
def light_embed(cls) -> Self:
507-
"""A factory method that returns a :class:`Colour` with a value of ``0xEEEFF1``.
571+
"""A factory method that returns a :class:`Colour` with a value of ``0xFFFFFF``.
508572
509573
.. colour:: #EEEFF1
510574
511575
.. versionadded:: 2.2
576+
577+
.. versionchanged:: 2.6
578+
Updated colour from previous ``0xEEEFF1`` to reflect discord theme changes.
512579
"""
513-
return cls(0xEEEFF1)
580+
return cls(0xFFFFFF)
514581

515582
@classmethod
516583
def pink(cls) -> Self:

tests/test_colour.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,20 +106,23 @@ def test_from_str_failures(value):
106106
(discord.Colour.og_blurple(), 0x7289DA),
107107
(discord.Colour.blurple(), 0x5865F2),
108108
(discord.Colour.greyple(), 0x99AAB5),
109-
(discord.Colour.dark_theme(), 0x313338),
109+
(discord.Colour.ash_theme(), 0x2E2E34),
110+
(discord.Colour.dark_theme(), 0x1A1A1E),
111+
(discord.Colour.onyx_theme(), 0x070709),
112+
(discord.Colour.light_theme(), 0xFBFBFB),
110113
(discord.Colour.fuchsia(), 0xEB459E),
111114
(discord.Colour.yellow(), 0xFEE75C),
112-
(discord.Colour.dark_embed(), 0x2B2D31),
113-
(discord.Colour.light_embed(), 0xEEEFF1),
115+
(discord.Colour.ash_embed(), 0x37373E),
116+
(discord.Colour.dark_embed(), 0x242429),
117+
(discord.Colour.onyx_embed(), 0x131416),
118+
(discord.Colour.light_embed(), 0xFFFFFF),
114119
(discord.Colour.pink(), 0xEB459F),
115120
],
116121
)
117122
def test_static_colours(value, expected):
118123
assert value.value == expected
119124

120125

121-
122-
123126
@pytest.mark.parametrize(
124127
('value', 'property', 'expected'),
125128
[

0 commit comments

Comments
 (0)