From 1e512aeeffaf49935f17adb42e894e944dba9b57 Mon Sep 17 00:00:00 2001 From: christopher-hampson Date: Sat, 17 Aug 2024 21:00:34 +0100 Subject: [PATCH 1/5] feat: added dvipsnames color palette --- manim/utils/color/dvipsnames.py | 96 +++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 manim/utils/color/dvipsnames.py diff --git a/manim/utils/color/dvipsnames.py b/manim/utils/color/dvipsnames.py new file mode 100644 index 0000000000..875ca9eba6 --- /dev/null +++ b/manim/utils/color/dvipsnames.py @@ -0,0 +1,96 @@ +"""DVIPSNAMES Colors + +This module contains colors defined in the DVIPS driver and 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 (taken from https://en.wikibooks.org/wiki/LaTeX/Colors#The_68_standard_colors_known_to_dvips) +are intended to simulate the ones defined in the DVIPS driver: + +.. 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") From 34438c3c721ff09e7be3ac8224ba4742301a4eb9 Mon Sep 17 00:00:00 2001 From: christopher-hampson Date: Fri, 23 Aug 2024 09:57:45 +0100 Subject: [PATCH 2/5] added svgnames color palette --- .../color/{dvipsnames.py => DVIPSNAMES.py} | 4 +- manim/utils/color/SVGNAMES.py | 179 ++++++++++++++++++ manim/utils/color/__init__.py | 4 +- 3 files changed, 184 insertions(+), 3 deletions(-) rename manim/utils/color/{dvipsnames.py => DVIPSNAMES.py} (94%) create mode 100644 manim/utils/color/SVGNAMES.py diff --git a/manim/utils/color/dvipsnames.py b/manim/utils/color/DVIPSNAMES.py similarity index 94% rename from manim/utils/color/dvipsnames.py rename to manim/utils/color/DVIPSNAMES.py index 875ca9eba6..4192507e05 100644 --- a/manim/utils/color/dvipsnames.py +++ b/manim/utils/color/DVIPSNAMES.py @@ -15,8 +15,8 @@ List of Color Constants ----------------------- -These hex values (taken from https://en.wikibooks.org/wiki/LaTeX/Colors#The_68_standard_colors_known_to_dvips) -are intended to simulate the ones defined in the DVIPS driver: +These hex values are derived from those specified in the `xcolor` package +documentation (see https://ctan.org/pkg/xcolor): .. automanimcolormodule:: manim.utils.color.DVIPSNAMES diff --git a/manim/utils/color/SVGNAMES.py b/manim/utils/color/SVGNAMES.py new file mode 100644 index 0000000000..02d9b36051 --- /dev/null +++ b/manim/utils/color/SVGNAMES.py @@ -0,0 +1,179 @@ +"""SVGNAMES Colors + +This module contains colors defined in the SVG 1.1 specification and 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") diff --git a/manim/utils/color/__init__.py b/manim/utils/color/__init__.py index 362a31ac25..0b1d37d3ae 100644 --- a/manim/utils/color/__init__.py +++ b/manim/utils/color/__init__.py @@ -42,6 +42,8 @@ manim_colors AS2700 BS381 + DVIPSNAMES + SVGNAMES XKCD X11 @@ -49,7 +51,7 @@ 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 * From dbb4917175b689b324cfe28633c7361a3d8365aa Mon Sep 17 00:00:00 2001 From: christopher-hampson Date: Fri, 23 Aug 2024 14:01:07 +0100 Subject: [PATCH 3/5] fixed docstrings --- manim/utils/color/DVIPSNAMES.py | 2 +- manim/utils/color/SVGNAMES.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/manim/utils/color/DVIPSNAMES.py b/manim/utils/color/DVIPSNAMES.py index 4192507e05..541fd87779 100644 --- a/manim/utils/color/DVIPSNAMES.py +++ b/manim/utils/color/DVIPSNAMES.py @@ -10,7 +10,7 @@ >>> from manim import DVIPSNAMES >>> DVIPSNAMES.DARKORCHID - ManimColor("#A4538A") + ManimColor('#A4538A') List of Color Constants ----------------------- diff --git a/manim/utils/color/SVGNAMES.py b/manim/utils/color/SVGNAMES.py index 02d9b36051..5bbf064f8b 100644 --- a/manim/utils/color/SVGNAMES.py +++ b/manim/utils/color/SVGNAMES.py @@ -10,7 +10,7 @@ >>> from manim import SVGNAMES >>> SVGNAMES.LIGHTCORAL - ManimColor("##EF7F7F") + ManimColor('#EF7F7F') List of Color Constants ----------------------- From 5df2e3ca48db31b2347dbd4184441f527cca130e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Manr=C3=ADquez?= Date: Mon, 28 Oct 2024 12:49:59 -0300 Subject: [PATCH 4/5] Commit changes requested by JasonGrace2282 --- manim/utils/color/DVIPSNAMES.py | 6 +++--- manim/utils/color/SVGNAMES.py | 6 +++--- manim/utils/color/__init__.py | 5 +++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/manim/utils/color/DVIPSNAMES.py b/manim/utils/color/DVIPSNAMES.py index 541fd87779..975b240ce1 100644 --- a/manim/utils/color/DVIPSNAMES.py +++ b/manim/utils/color/DVIPSNAMES.py @@ -1,7 +1,7 @@ -"""DVIPSNAMES Colors +r"""dvips Colors -This module contains colors defined in the DVIPS driver and are commonly accessed -as named colors in LaTeX via the `\\usepackage[dvipsnames]{xcolor}` package. +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): diff --git a/manim/utils/color/SVGNAMES.py b/manim/utils/color/SVGNAMES.py index 5bbf064f8b..52cd8074b1 100644 --- a/manim/utils/color/SVGNAMES.py +++ b/manim/utils/color/SVGNAMES.py @@ -1,7 +1,7 @@ -"""SVGNAMES Colors +r"""SVG 1.1 Colors -This module contains colors defined in the SVG 1.1 specification and are commonly -accessed as named colors in LaTeX via the `\\usepackage[svgnames]{xcolor}` package. +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): diff --git a/manim/utils/color/__init__.py b/manim/utils/color/__init__.py index 0b1d37d3ae..7ef3cb3505 100644 --- a/manim/utils/color/__init__.py +++ b/manim/utils/color/__init__.py @@ -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 From 66c06ca1534edfc651f47ef01e1b7ef540103738 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Manr=C3=ADquez?= Date: Mon, 28 Oct 2024 12:58:04 -0300 Subject: [PATCH 5/5] Double backticks in xcolor --- manim/utils/color/DVIPSNAMES.py | 2 +- manim/utils/color/SVGNAMES.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/manim/utils/color/DVIPSNAMES.py b/manim/utils/color/DVIPSNAMES.py index 975b240ce1..88fe8cf680 100644 --- a/manim/utils/color/DVIPSNAMES.py +++ b/manim/utils/color/DVIPSNAMES.py @@ -15,7 +15,7 @@ List of Color Constants ----------------------- -These hex values are derived from those specified in the `xcolor` package +These hex values are derived from those specified in the ``xcolor`` package documentation (see https://ctan.org/pkg/xcolor): .. automanimcolormodule:: manim.utils.color.DVIPSNAMES diff --git a/manim/utils/color/SVGNAMES.py b/manim/utils/color/SVGNAMES.py index 52cd8074b1..d59eed66b4 100644 --- a/manim/utils/color/SVGNAMES.py +++ b/manim/utils/color/SVGNAMES.py @@ -15,7 +15,7 @@ List of Color Constants ----------------------- -These hex values are derived from those specified in the `xcolor` package +These hex values are derived from those specified in the ``xcolor`` package documentation (see https://ctan.org/pkg/xcolor): .. automanimcolormodule:: manim.utils.color.SVGNAMES