added embed_background color

This commit is contained in:
Daishiky 2021-09-19 18:51:02 +02:00 committed by GitHub
parent 9356e385d8
commit d2aae4752a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5563,4 +5563,22 @@ class Colour:
"""A factory method that returns a :class:`Colour` with a value of ``0xFDDDE6``."""
return cls(0xFDDDE6)
@classmethod
def embed_background(theme: str = "dark", cls: Type[CT]) -> CT:
"""A factory method that returns a :class:`Color` with a value of
``0x2F3136`` (dark)
``0xf2f3f5`` (light).
.. versionadded:: 2.0
"""
themes_cls = {
"dark": 0x2F3136,
"light": 0xf2f3f5
}
if theme not in themes_cls:
raise TypeError("Theme must be one of \"dark\" and \"light\".")
return cls(themes_cls[theme])
Color = Colour