Skip to content

Commit

Permalink
Feat: dvipsnames and svgnames color palettes (#3913)
Browse files Browse the repository at this point in the history
* feat: added dvipsnames color palette

* added svgnames color palette

* fixed docstrings

* Commit changes requested by JasonGrace2282

* Double backticks in xcolor

---------

Co-authored-by: Francisco Manríquez <[email protected]>
Co-authored-by: Francisco Manríquez Novoa <[email protected]>
Co-authored-by: Aarush Deshpande <[email protected]>
  • Loading branch information
4 people authored Nov 4, 2024
1 parent 9f1f239 commit c6edb33
Show file tree
Hide file tree
Showing 3 changed files with 281 additions and 3 deletions.
96 changes: 96 additions & 0 deletions manim/utils/color/DVIPSNAMES.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
r"""dvips Colors
This module contains the colors defined in the dvips driver, which are commonly accessed
as named colors in LaTeX via the ``\usepackage[dvipsnames]{xcolor}`` package.
To use the colors from this list, access them directly from the module (which
is exposed to Manim's global name space):
.. code:: pycon
>>> from manim import DVIPSNAMES
>>> DVIPSNAMES.DARKORCHID
ManimColor('#A4538A')
List of Color Constants
-----------------------
These hex values are derived from those specified in the ``xcolor`` package
documentation (see https://ctan.org/pkg/xcolor):
.. automanimcolormodule:: manim.utils.color.DVIPSNAMES
"""

from __future__ import annotations

from .core import ManimColor

AQUAMARINE = ManimColor("#00B5BE")
BITTERSWEET = ManimColor("#C04F17")
APRICOT = ManimColor("#FBB982")
BLACK = ManimColor("#221E1F")
BLUE = ManimColor("#2D2F92")
BLUEGREEN = ManimColor("#00B3B8")
BLUEVIOLET = ManimColor("#473992")
BRICKRED = ManimColor("#B6321C")
BROWN = ManimColor("#792500")
BURNTORANGE = ManimColor("#F7921D")
CADETBLUE = ManimColor("#74729A")
CARNATIONPINK = ManimColor("#F282B4")
CERULEAN = ManimColor("#00A2E3")
CORNFLOWERBLUE = ManimColor("#41B0E4")
CYAN = ManimColor("#00AEEF")
DANDELION = ManimColor("#FDBC42")
DARKORCHID = ManimColor("#A4538A")
EMERALD = ManimColor("#00A99D")
FORESTGREEN = ManimColor("#009B55")
FUCHSIA = ManimColor("#8C368C")
GOLDENROD = ManimColor("#FFDF42")
GRAY = ManimColor("#949698")
GREEN = ManimColor("#00A64F")
GREENYELLOW = ManimColor("#DFE674")
JUNGLEGREEN = ManimColor("#00A99A")
LAVENDER = ManimColor("#F49EC4")
LIMEGREEN = ManimColor("#8DC73E")
MAGENTA = ManimColor("#EC008C")
MAHOGANY = ManimColor("#A9341F")
MAROON = ManimColor("#AF3235")
MELON = ManimColor("#F89E7B")
MIDNIGHTBLUE = ManimColor("#006795")
MULBERRY = ManimColor("#A93C93")
NAVYBLUE = ManimColor("#006EB8")
OLIVEGREEN = ManimColor("#3C8031")
ORANGE = ManimColor("#F58137")
ORANGERED = ManimColor("#ED135A")
ORCHID = ManimColor("#AF72B0")
PEACH = ManimColor("#F7965A")
PERIWINKLE = ManimColor("#7977B8")
PINEGREEN = ManimColor("#008B72")
PLUM = ManimColor("#92268F")
PROCESSBLUE = ManimColor("#00B0F0")
PURPLE = ManimColor("#99479B")
RAWSIENNA = ManimColor("#974006")
RED = ManimColor("#ED1B23")
REDORANGE = ManimColor("#F26035")
REDVIOLET = ManimColor("#A1246B")
RHODAMINE = ManimColor("#EF559F")
ROYALBLUE = ManimColor("#0071BC")
ROYALPURPLE = ManimColor("#613F99")
RUBINERED = ManimColor("#ED017D")
SALMON = ManimColor("#F69289")
SEAGREEN = ManimColor("#3FBC9D")
SEPIA = ManimColor("#671800")
SKYBLUE = ManimColor("#46C5DD")
SPRINGGREEN = ManimColor("#C6DC67")
TAN = ManimColor("#DA9D76")
TEALBLUE = ManimColor("#00AEB3")
THISTLE = ManimColor("#D883B7")
TURQUOISE = ManimColor("#00B4CE")
VIOLET = ManimColor("#58429B")
VIOLETRED = ManimColor("#EF58A0")
WHITE = ManimColor("#FFFFFF")
WILDSTRAWBERRY = ManimColor("#EE2967")
YELLOW = ManimColor("#FFF200")
YELLOWGREEN = ManimColor("#98CC70")
YELLOWORANGE = ManimColor("#FAA21A")
179 changes: 179 additions & 0 deletions manim/utils/color/SVGNAMES.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
r"""SVG 1.1 Colors
This module contains the colors defined in the SVG 1.1 specification, which are commonly
accessed as named colors in LaTeX via the ``\usepackage[svgnames]{xcolor}`` package.
To use the colors from this list, access them directly from the module (which
is exposed to Manim's global name space):
.. code:: pycon
>>> from manim import SVGNAMES
>>> SVGNAMES.LIGHTCORAL
ManimColor('#EF7F7F')
List of Color Constants
-----------------------
These hex values are derived from those specified in the ``xcolor`` package
documentation (see https://ctan.org/pkg/xcolor):
.. automanimcolormodule:: manim.utils.color.SVGNAMES
"""

from __future__ import annotations

from .core import ManimColor

ALICEBLUE = ManimColor("#EFF7FF")
ANTIQUEWHITE = ManimColor("#F9EAD7")
AQUA = ManimColor("#00FFFF")
AQUAMARINE = ManimColor("#7EFFD3")
AZURE = ManimColor("#EFFFFF")
BEIGE = ManimColor("#F4F4DC")
BISQUE = ManimColor("#FFE3C4")
BLACK = ManimColor("#000000")
BLANCHEDALMOND = ManimColor("#FFEACD")
BLUE = ManimColor("#0000FF")
BLUEVIOLET = ManimColor("#892BE2")
BROWN = ManimColor("#A52A2A")
BURLYWOOD = ManimColor("#DDB787")
CADETBLUE = ManimColor("#5E9EA0")
CHARTREUSE = ManimColor("#7EFF00")
CHOCOLATE = ManimColor("#D2681D")
CORAL = ManimColor("#FF7E4F")
CORNFLOWERBLUE = ManimColor("#6395ED")
CORNSILK = ManimColor("#FFF7DC")
CRIMSON = ManimColor("#DC143B")
CYAN = ManimColor("#00FFFF")
DARKBLUE = ManimColor("#00008A")
DARKCYAN = ManimColor("#008A8A")
DARKGOLDENROD = ManimColor("#B7850B")
DARKGRAY = ManimColor("#A9A9A9")
DARKGREEN = ManimColor("#006300")
DARKGREY = ManimColor("#A9A9A9")
DARKKHAKI = ManimColor("#BCB66B")
DARKMAGENTA = ManimColor("#8A008A")
DARKOLIVEGREEN = ManimColor("#546B2F")
DARKORANGE = ManimColor("#FF8C00")
DARKORCHID = ManimColor("#9931CC")
DARKRED = ManimColor("#8A0000")
DARKSALMON = ManimColor("#E8967A")
DARKSEAGREEN = ManimColor("#8EBB8E")
DARKSLATEBLUE = ManimColor("#483D8A")
DARKSLATEGRAY = ManimColor("#2F4F4F")
DARKSLATEGREY = ManimColor("#2F4F4F")
DARKTURQUOISE = ManimColor("#00CED1")
DARKVIOLET = ManimColor("#9300D3")
DEEPPINK = ManimColor("#FF1492")
DEEPSKYBLUE = ManimColor("#00BFFF")
DIMGRAY = ManimColor("#686868")
DIMGREY = ManimColor("#686868")
DODGERBLUE = ManimColor("#1D90FF")
FIREBRICK = ManimColor("#B12121")
FLORALWHITE = ManimColor("#FFF9EF")
FORESTGREEN = ManimColor("#218A21")
FUCHSIA = ManimColor("#FF00FF")
GAINSBORO = ManimColor("#DCDCDC")
GHOSTWHITE = ManimColor("#F7F7FF")
GOLD = ManimColor("#FFD700")
GOLDENROD = ManimColor("#DAA51F")
GRAY = ManimColor("#7F7F7F")
GREEN = ManimColor("#007F00")
GREENYELLOW = ManimColor("#ADFF2F")
GREY = ManimColor("#7F7F7F")
HONEYDEW = ManimColor("#EFFFEF")
HOTPINK = ManimColor("#FF68B3")
INDIANRED = ManimColor("#CD5B5B")
INDIGO = ManimColor("#4A0082")
IVORY = ManimColor("#FFFFEF")
KHAKI = ManimColor("#EFE58C")
LAVENDER = ManimColor("#E5E5F9")
LAVENDERBLUSH = ManimColor("#FFEFF4")
LAWNGREEN = ManimColor("#7CFC00")
LEMONCHIFFON = ManimColor("#FFF9CD")
LIGHTBLUE = ManimColor("#ADD8E5")
LIGHTCORAL = ManimColor("#EF7F7F")
LIGHTCYAN = ManimColor("#E0FFFF")
LIGHTGOLDENROD = ManimColor("#EDDD82")
LIGHTGOLDENRODYELLOW = ManimColor("#F9F9D2")
LIGHTGRAY = ManimColor("#D3D3D3")
LIGHTGREEN = ManimColor("#90ED90")
LIGHTGREY = ManimColor("#D3D3D3")
LIGHTPINK = ManimColor("#FFB5C0")
LIGHTSALMON = ManimColor("#FFA07A")
LIGHTSEAGREEN = ManimColor("#1FB1AA")
LIGHTSKYBLUE = ManimColor("#87CEF9")
LIGHTSLATEBLUE = ManimColor("#8470FF")
LIGHTSLATEGRAY = ManimColor("#778799")
LIGHTSLATEGREY = ManimColor("#778799")
LIGHTSTEELBLUE = ManimColor("#AFC4DD")
LIGHTYELLOW = ManimColor("#FFFFE0")
LIME = ManimColor("#00FF00")
LIMEGREEN = ManimColor("#31CD31")
LINEN = ManimColor("#F9EFE5")
MAGENTA = ManimColor("#FF00FF")
MAROON = ManimColor("#7F0000")
MEDIUMAQUAMARINE = ManimColor("#66CDAA")
MEDIUMBLUE = ManimColor("#0000CD")
MEDIUMORCHID = ManimColor("#BA54D3")
MEDIUMPURPLE = ManimColor("#9270DB")
MEDIUMSEAGREEN = ManimColor("#3BB271")
MEDIUMSLATEBLUE = ManimColor("#7B68ED")
MEDIUMSPRINGGREEN = ManimColor("#00F99A")
MEDIUMTURQUOISE = ManimColor("#48D1CC")
MEDIUMVIOLETRED = ManimColor("#C61584")
MIDNIGHTBLUE = ManimColor("#181870")
MINTCREAM = ManimColor("#F4FFF9")
MISTYROSE = ManimColor("#FFE3E1")
MOCCASIN = ManimColor("#FFE3B5")
NAVAJOWHITE = ManimColor("#FFDDAD")
NAVY = ManimColor("#00007F")
NAVYBLUE = ManimColor("#00007F")
OLDLACE = ManimColor("#FCF4E5")
OLIVE = ManimColor("#7F7F00")
OLIVEDRAB = ManimColor("#6B8D22")
ORANGE = ManimColor("#FFA500")
ORANGERED = ManimColor("#FF4400")
ORCHID = ManimColor("#DA70D6")
PALEGOLDENROD = ManimColor("#EDE8AA")
PALEGREEN = ManimColor("#97FB97")
PALETURQUOISE = ManimColor("#AFEDED")
PALEVIOLETRED = ManimColor("#DB7092")
PAPAYAWHIP = ManimColor("#FFEED4")
PEACHPUFF = ManimColor("#FFDAB8")
PERU = ManimColor("#CD843F")
PINK = ManimColor("#FFBFCA")
PLUM = ManimColor("#DDA0DD")
POWDERBLUE = ManimColor("#AFE0E5")
PURPLE = ManimColor("#7F007F")
RED = ManimColor("#FF0000")
ROSYBROWN = ManimColor("#BB8E8E")
ROYALBLUE = ManimColor("#4168E1")
SADDLEBROWN = ManimColor("#8A4413")
SALMON = ManimColor("#F97F72")
SANDYBROWN = ManimColor("#F3A45F")
SEAGREEN = ManimColor("#2D8A56")
SEASHELL = ManimColor("#FFF4ED")
SIENNA = ManimColor("#A0512C")
SILVER = ManimColor("#BFBFBF")
SKYBLUE = ManimColor("#87CEEA")
SLATEBLUE = ManimColor("#6959CD")
SLATEGRAY = ManimColor("#707F90")
SLATEGREY = ManimColor("#707F90")
SNOW = ManimColor("#FFF9F9")
SPRINGGREEN = ManimColor("#00FF7E")
STEELBLUE = ManimColor("#4682B3")
TAN = ManimColor("#D2B38C")
TEAL = ManimColor("#007F7F")
THISTLE = ManimColor("#D8BFD8")
TOMATO = ManimColor("#FF6347")
TURQUOISE = ManimColor("#3FE0CF")
VIOLET = ManimColor("#ED82ED")
VIOLETRED = ManimColor("#D01F90")
WHEAT = ManimColor("#F4DDB2")
WHITE = ManimColor("#FFFFFF")
WHITESMOKE = ManimColor("#F4F4F4")
YELLOW = ManimColor("#FFFF00")
YELLOWGREEN = ManimColor("#9ACD30")
9 changes: 6 additions & 3 deletions manim/utils/color/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
- The colors listed in :mod:`.color.manim_colors` are loaded into
Manim's global name space.
- The colors in :mod:`.color.AS2700`, :mod:`.color.BS381`, :mod:`.color.X11`,
and :mod:`.color.XKCD` need to be accessed via their module (which are available
- The colors in :mod:`.color.AS2700`, :mod:`.color.BS381`,
:mod:`.color.DVIPSNAMES`, :mod:`.color.SVGNAMES`, :mod:`.color.X11` and
:mod:`.color.XKCD` need to be accessed via their module (which are available
in Manim's global name space), or imported separately. For example:
.. code:: pycon
Expand All @@ -42,14 +43,16 @@
manim_colors
AS2700
BS381
DVIPSNAMES
SVGNAMES
XKCD
X11
"""

from __future__ import annotations

from . import AS2700, BS381, X11, XKCD
from . import AS2700, BS381, DVIPSNAMES, SVGNAMES, X11, XKCD
from .core import *
from .manim_colors import *

Expand Down

0 comments on commit c6edb33

Please sign in to comment.