Skip to content

Commit cc206ba

Browse files
kolibril13leotrs
andauthored
# Moving Colors to Enums
Co-authored-by: Leo Torres <[email protected]>
1 parent 9271ca8 commit cc206ba

31 files changed

+265
-92
lines changed

docs/source/changelog.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ Of interest to developers
9292
#. Added logging tests tools.
9393
#. Added ability to save logs in json
9494
#. Move to Poetry.
95+
#. Colors have moved to an Enum
9596

9697
Other Changes
9798
--------------

manim/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565

6666
from .utils.bezier import *
6767
from .utils.color import *
68+
from .utils import color as color
6869
from .utils.config_ops import *
6970
from .utils.debug import *
7071
from .utils.images import *

manim/animation/indication.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
from ..utils.config_ops import digest_config
4141
from ..utils.rate_functions import there_and_back
4242
from ..utils.rate_functions import wiggle
43+
from ..utils.color import GREY, YELLOW
4344

4445

4546
class FocusOn(Transform):

manim/animation/specialized.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,12 @@
88
from ..animation.composition import LaggedStart
99
from ..animation.transform import ApplyMethod
1010
from ..animation.transform import Restore
11-
from ..constants import WHITE
12-
from ..constants import BLACK
1311
from ..mobject.geometry import Circle
1412
from ..mobject.svg.drawings import Car
1513
from ..mobject.types.vectorized_mobject import VGroup
1614
from ..utils.config_ops import digest_config
1715
from ..utils.space_ops import get_norm
16+
from ..utils.color import BLACK, WHITE
1817

1918

2019
class MoveCar(ApplyMethod):

manim/camera/camera.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from ..mobject.mobject import Mobject
2121
from ..mobject.types.point_cloud_mobject import PMobject
2222
from ..mobject.types.vectorized_mobject import VMobject
23-
from ..utils.color import color_to_int_rgba
23+
from ..utils.color import color_to_int_rgba, BLACK
2424
from ..utils.config_ops import digest_config
2525
from ..utils.images import get_full_raster_image_path
2626
from ..utils.iterables import list_difference_update

manim/camera/moving_camera.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@
1111

1212
from .. import config
1313
from ..camera.camera import Camera
14-
from ..constants import ORIGIN, WHITE
14+
from ..constants import ORIGIN
1515
from ..mobject.frame import ScreenRectangle
1616
from ..mobject.types.vectorized_mobject import VGroup
1717
from ..utils.config_ops import digest_config
18+
from ..utils.color import WHITE
1819

1920

2021
# TODO, think about how to incorporate perspective

manim/constants.py

Lines changed: 0 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -112,76 +112,6 @@ class MyText(Text):
112112
# gif stuff
113113
GIF_FILE_EXTENSION = ".gif"
114114

115-
# Colors
116-
COLOR_MAP = {
117-
"DARK_BLUE": "#236B8E",
118-
"DARK_BROWN": "#8B4513",
119-
"LIGHT_BROWN": "#CD853F",
120-
"BLUE_E": "#1C758A",
121-
"BLUE_D": "#29ABCA",
122-
"BLUE_C": "#58C4DD",
123-
"BLUE_B": "#9CDCEB",
124-
"BLUE_A": "#C7E9F1",
125-
"TEAL_E": "#49A88F",
126-
"TEAL_D": "#55C1A7",
127-
"TEAL_C": "#5CD0B3",
128-
"TEAL_B": "#76DDC0",
129-
"TEAL_A": "#ACEAD7",
130-
"GREEN_E": "#699C52",
131-
"GREEN_D": "#77B05D",
132-
"GREEN_C": "#83C167",
133-
"GREEN_B": "#A6CF8C",
134-
"GREEN_A": "#C9E2AE",
135-
"YELLOW_E": "#E8C11C",
136-
"YELLOW_D": "#F4D345",
137-
"YELLOW_C": "#FFFF00",
138-
"YELLOW_B": "#FFEA94",
139-
"YELLOW_A": "#FFF1B6",
140-
"GOLD_E": "#C78D46",
141-
"GOLD_D": "#E1A158",
142-
"GOLD_C": "#F0AC5F",
143-
"GOLD_B": "#F9B775",
144-
"GOLD_A": "#F7C797",
145-
"RED_E": "#CF5044",
146-
"RED_D": "#E65A4C",
147-
"RED_C": "#FC6255",
148-
"RED_B": "#FF8080",
149-
"RED_A": "#F7A1A3",
150-
"MAROON_E": "#94424F",
151-
"MAROON_D": "#A24D61",
152-
"MAROON_C": "#C55F73",
153-
"MAROON_B": "#EC92AB",
154-
"MAROON_A": "#ECABC1",
155-
"PURPLE_E": "#644172",
156-
"PURPLE_D": "#715582",
157-
"PURPLE_C": "#9A72AC",
158-
"PURPLE_B": "#B189C6",
159-
"PURPLE_A": "#CAA3E8",
160-
"WHITE": "#FFFFFF",
161-
"BLACK": "#000000",
162-
"LIGHT_GRAY": "#BBBBBB",
163-
"LIGHT_GREY": "#BBBBBB",
164-
"GRAY": "#888888",
165-
"GREY": "#888888",
166-
"DARK_GREY": "#444444",
167-
"DARK_GRAY": "#444444",
168-
"DARKER_GREY": "#222222",
169-
"DARKER_GRAY": "#222222",
170-
"GREY_BROWN": "#736357",
171-
"PINK": "#D147BD",
172-
"LIGHT_PINK": "#DC75CD",
173-
"GREEN_SCREEN": "#00FF00",
174-
"ORANGE": "#FF862F",
175-
}
176-
COLOR_MAP.update(
177-
{
178-
name.replace("_C", ""): COLOR_MAP[name]
179-
for name in COLOR_MAP
180-
if name.endswith("_C")
181-
}
182-
)
183-
PALETTE = list(COLOR_MAP.values())
184-
locals().update(COLOR_MAP)
185115
FFMPEG_VERBOSITY_MAP = {
186116
"DEBUG": "error",
187117
"INFO": "error",

manim/mobject/changing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
__all__ = ["AnimatedBoundary", "TracedPath"]
44

5-
65
from ..constants import *
76
from ..mobject.types.vectorized_mobject import VMobject
87
from ..mobject.types.vectorized_mobject import VGroup
98
from ..utils.rate_functions import smooth
109
from ..utils.space_ops import get_norm
10+
from ..utils.color import BLUE_D, BLUE_B, BLUE_E, GREY_BROWN, WHITE
1111

1212

1313
class AnimatedBoundary(VGroup):

manim/mobject/coordinate_systems.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
from ..utils.config_ops import merge_dicts_recursively
1919
from ..utils.simple_functions import binary_search
2020
from ..utils.space_ops import angle_of_vector
21+
from ..utils.color import LIGHT_GREY, WHITE, BLUE_D, BLUE
22+
2123

2224
# TODO: There should be much more code reuse between Axes, NumberPlane and GraphScene
2325

manim/mobject/frame.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from ..constants import *
1313
from ..mobject.geometry import Rectangle
1414
from ..utils.config_ops import digest_config
15+
from ..utils.color import BLACK
1516

1617

1718
class ScreenRectangle(Rectangle):

0 commit comments

Comments
 (0)