Fix YELLOW_C and add PURE_CYAN, PURE_MAGENTA and PURE_YELLOW (#4562)

* Fix YELLOW_C and add PURE_CYAN, PURE_MAGENTA and PURE_YELLOW

* update default colors YELLOW -> PURE_YELLOW throughout the library

* chore: format + check

* Modify RandomColorGenerator.next() doctest whose output changed by adding colors

---------

Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
This commit is contained in:
Francisco Manríquez Novoa 2026-02-16 20:07:09 -03:00 committed by GitHub
commit a5d4ab134c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 69 additions and 57 deletions

View file

@ -64,7 +64,7 @@ from ..mobject.mobject import Mobject
from ..mobject.types.vectorized_mobject import VGroup, VMobject
from ..typing import Point3D, Point3DLike, Vector3DLike
from ..utils.bezier import interpolate, inverse_interpolate
from ..utils.color import GREY, YELLOW, ParsableManimColor
from ..utils.color import GREY, PURE_YELLOW, ParsableManimColor
from ..utils.rate_functions import RateFunction, smooth, there_and_back, wiggle
from ..utils.space_ops import normalize
@ -89,7 +89,7 @@ class FocusOn(Transform):
class UsingFocusOn(Scene):
def construct(self):
dot = Dot(color=YELLOW).shift(DOWN)
dot = Dot(color=PURE_YELLOW).shift(DOWN)
self.add(Tex("Focusing on the dot below:"), dot)
self.play(FocusOn(dot))
self.wait()
@ -153,7 +153,7 @@ class Indicate(Transform):
self,
mobject: Mobject,
scale_factor: float = 1.2,
color: ParsableManimColor = YELLOW,
color: ParsableManimColor = PURE_YELLOW,
rate_func: RateFunction = there_and_back,
**kwargs: Any,
):
@ -198,7 +198,7 @@ class Flash(AnimationGroup):
class UsingFlash(Scene):
def construct(self):
dot = Dot(color=YELLOW).shift(DOWN)
dot = Dot(color=PURE_YELLOW).shift(DOWN)
self.add(Tex("Flash the dot below:"), dot)
self.play(Flash(dot))
self.wait()
@ -226,7 +226,7 @@ class Flash(AnimationGroup):
num_lines: int = 12,
flash_radius: float = 0.1,
line_stroke_width: int = 3,
color: ParsableManimColor = YELLOW,
color: ParsableManimColor = PURE_YELLOW,
time_width: float = 1,
run_time: float = 1.0,
**kwargs: Any,
@ -618,7 +618,7 @@ class Circumscribe(Succession):
fade_out: bool = False,
time_width: float = 0.3,
buff: float = SMALL_BUFF,
color: ParsableManimColor = YELLOW,
color: ParsableManimColor = PURE_YELLOW,
run_time: float = 1,
stroke_width: float = DEFAULT_STROKE_WIDTH,
**kwargs: Any,

View file

@ -20,7 +20,7 @@ from manim.mobject.geometry.polygram import RoundedRectangle
from manim.mobject.mobject import Mobject
from manim.mobject.opengl.opengl_mobject import OpenGLMobject
from manim.mobject.types.vectorized_mobject import VGroup
from manim.utils.color import BLACK, RED, YELLOW, ParsableManimColor
from manim.utils.color import BLACK, PURE_YELLOW, RED, ParsableManimColor
class SurroundingRectangle(RoundedRectangle):
@ -50,7 +50,7 @@ class SurroundingRectangle(RoundedRectangle):
def __init__(
self,
*mobjects: Mobject,
color: ParsableManimColor = YELLOW,
color: ParsableManimColor = PURE_YELLOW,
buff: float | tuple[float, float] = SMALL_BUFF,
corner_radius: float = 0.0,
**kwargs: Any,

View file

@ -42,8 +42,8 @@ from manim.utils.color import (
BLUE,
BLUE_D,
GREEN,
PURE_YELLOW,
WHITE,
YELLOW,
ManimColor,
ParsableManimColor,
color_gradient,
@ -1614,7 +1614,7 @@ class CoordinateSystem:
x: float,
graph: ParametricFunction,
dx: float | None = None,
dx_line_color: ParsableManimColor = YELLOW,
dx_line_color: ParsableManimColor = PURE_YELLOW,
dy_line_color: ParsableManimColor | None = None,
dx_label: float | str | None = None,
dy_label: float | str | None = None,
@ -1796,7 +1796,7 @@ class CoordinateSystem:
triangle_size: float = MED_SMALL_BUFF,
triangle_color: ParsableManimColor | None = WHITE,
line_func: type[Line] = Line,
line_color: ParsableManimColor = YELLOW,
line_color: ParsableManimColor = PURE_YELLOW,
) -> VGroup:
"""Creates a labelled triangle marker with a vertical line from the x-axis
to a curve at a given x-value.
@ -2293,7 +2293,7 @@ class Axes(VGroup, CoordinateSystem, metaclass=ConvertToOpenGL):
x_values: Iterable[float],
y_values: Iterable[float],
z_values: Iterable[float] | None = None,
line_color: ParsableManimColor = YELLOW,
line_color: ParsableManimColor = PURE_YELLOW,
add_vertex_dots: bool = True,
vertex_dot_radius: float = DEFAULT_DOT_RADIUS,
vertex_dot_style: dict[str, Any] | None = None,

View file

@ -22,7 +22,7 @@ if TYPE_CHECKING:
from manim.typing import Point3D, Point3DLike
from manim.utils.color import ParsableManimColor
from manim.utils.color import YELLOW
from manim.utils.color import PURE_YELLOW
class ParametricFunction(VMobject, metaclass=ConvertToOpenGL):
@ -217,7 +217,7 @@ class FunctionGraph(ParametricFunction):
self,
function: Callable[[float], Any],
x_range: tuple[float, float] | tuple[float, float, float] | None = None,
color: ParsableManimColor = YELLOW,
color: ParsableManimColor = PURE_YELLOW,
**kwargs: Any,
) -> None:
if x_range is None:

View file

@ -28,8 +28,8 @@ from .. import config, logger
from ..constants import *
from ..utils.color import (
BLACK,
PURE_YELLOW,
WHITE,
YELLOW_C,
ManimColor,
ParsableManimColor,
color_gradient,
@ -1965,7 +1965,7 @@ class Mobject:
# Color functions
def set_color(
self, color: ParsableManimColor = YELLOW_C, family: bool = True
self, color: ParsableManimColor = PURE_YELLOW, family: bool = True
) -> Self:
"""Condition is function which takes in one arguments, (x, y, z).
Here it just recurses to submobjects, but in subclasses this

View file

@ -9,13 +9,13 @@ import numpy as np
from manim.constants import ORIGIN, RIGHT, UP
from manim.mobject.opengl.opengl_point_cloud_mobject import OpenGLPMobject
from manim.typing import Point3DLike
from manim.utils.color import YELLOW, ParsableManimColor
from manim.utils.color import PURE_YELLOW, ParsableManimColor
class DotCloud(OpenGLPMobject):
def __init__(
self,
color: ParsableManimColor = YELLOW,
color: ParsableManimColor = PURE_YELLOW,
stroke_width: float = 2.0,
radius: float = 2.0,
density: float = 10,

View file

@ -12,8 +12,8 @@ from manim.mobject.opengl.opengl_mobject import OpenGLMobject
from manim.utils.bezier import interpolate
from manim.utils.color import (
BLACK,
PURE_YELLOW,
WHITE,
YELLOW,
ParsableManimColor,
color_gradient,
color_to_rgba,
@ -48,7 +48,7 @@ class OpenGLPMobject(OpenGLMobject):
def __init__(
self,
stroke_width: float = 2.0,
color: ParsableManimColor = YELLOW,
color: ParsableManimColor = PURE_YELLOW,
render_primitive: int = moderngl.POINTS,
**kwargs,
):
@ -79,7 +79,7 @@ class OpenGLPMobject(OpenGLMobject):
Rgbas must be a Nx4 numpy array if it is not None.
"""
if rgbas is None and color is None:
color = YELLOW
color = PURE_YELLOW
self.append_points(points)
# rgbas array will have been resized with points
if color is not None:

View file

@ -79,7 +79,7 @@ from ..animation.composition import AnimationGroup
from ..animation.creation import Create, Write
from ..animation.fading import FadeIn
from ..mobject.types.vectorized_mobject import VGroup, VMobject
from ..utils.color import BLACK, YELLOW, ManimColor, ParsableManimColor
from ..utils.color import BLACK, PURE_YELLOW, ManimColor, ParsableManimColor
from .utils import get_vectorized_mobject_class
@ -811,7 +811,10 @@ class Table(VGroup):
return rec
def get_highlighted_cell(
self, pos: Sequence[int] = (1, 1), color: ParsableManimColor = YELLOW, **kwargs
self,
pos: Sequence[int] = (1, 1),
color: ParsableManimColor = PURE_YELLOW,
**kwargs,
) -> BackgroundRectangle:
"""Returns a :class:`~.BackgroundRectangle` of the cell at the given position.
@ -847,7 +850,10 @@ class Table(VGroup):
return bg_cell
def add_highlighted_cell(
self, pos: Sequence[int] = (1, 1), color: ParsableManimColor = YELLOW, **kwargs
self,
pos: Sequence[int] = (1, 1),
color: ParsableManimColor = PURE_YELLOW,
**kwargs,
) -> Table:
"""Highlights one cell at a specific position on the table by adding a :class:`~.BackgroundRectangle`.

View file

@ -17,8 +17,8 @@ from ...mobject.mobject import Mobject
from ...utils.bezier import interpolate
from ...utils.color import (
BLACK,
PURE_YELLOW,
WHITE,
YELLOW,
ManimColor,
ParsableManimColor,
color_gradient,
@ -110,7 +110,7 @@ class PMobject(Mobject, metaclass=ConvertToOpenGL):
return self
def set_color(
self, color: ParsableManimColor = YELLOW, family: bool = True
self, color: ParsableManimColor = PURE_YELLOW, family: bool = True
) -> Self:
rgba = color_to_rgba(color)
mobs = self.family_members_with_points() if family else [self]
@ -359,7 +359,7 @@ class PointCloudDot(Mobject1D):
radius: float = 2.0,
stroke_width: int = 2,
density: int = DEFAULT_POINT_DENSITY_1D,
color: ManimColor = YELLOW,
color: ManimColor = PURE_YELLOW,
**kwargs: Any,
) -> None:
self.radius = radius

View file

@ -35,9 +35,9 @@ from ..utils.color import (
BLUE_D,
GREEN_C,
GREY,
PURE_YELLOW,
RED_C,
WHITE,
YELLOW,
ManimColor,
ParsableManimColor,
)
@ -172,7 +172,7 @@ class VectorScene(Scene):
def add_vector(
self,
vector: Arrow | Vector3DLike,
color: ParsableManimColor | Iterable[ParsableManimColor] = YELLOW,
color: ParsableManimColor | Iterable[ParsableManimColor] = PURE_YELLOW,
animate: bool = True,
**kwargs: Any,
) -> Arrow:
@ -808,7 +808,7 @@ class LinearTransformationScene(VectorScene):
def get_unit_square(
self,
color: ParsableManimColor | Iterable[ParsableManimColor] = YELLOW,
color: ParsableManimColor | Iterable[ParsableManimColor] = PURE_YELLOW,
opacity: float = 0.3,
stroke_width: float = 3,
) -> Rectangle:
@ -875,7 +875,7 @@ class LinearTransformationScene(VectorScene):
def add_vector(
self,
vector: Arrow | list | tuple | np.ndarray,
color: ParsableManimColor = YELLOW,
color: ParsableManimColor = PURE_YELLOW,
animate: bool = False,
**kwargs: Any,
) -> Arrow:

View file

@ -1520,7 +1520,7 @@ class RandomColorGenerator:
>>> rnd = RandomColorGenerator(42)
>>> rnd.next()
ManimColor('#ECE7E2')
ManimColor('#8B4513')
>>> rnd.next()
ManimColor('#BBBBBB')
>>> rnd.next()
@ -1530,7 +1530,7 @@ class RandomColorGenerator:
>>> rnd2 = RandomColorGenerator(42)
>>> rnd2.next()
ManimColor('#ECE7E2')
ManimColor('#8B4513')
>>> rnd2.next()
ManimColor('#BBBBBB')
>>> rnd2.next()

View file

@ -102,6 +102,9 @@ These colors form Manim's default color space.
"pure_red",
"pure_green",
"pure_blue",
"pure_cyan",
"pure_magenta",
"pure_yellow",
)
pure_lines = named_lines_group(
@ -145,12 +148,17 @@ DARK_GRAY = ManimColor("#444444")
DARK_GREY = ManimColor("#444444")
DARKER_GRAY = ManimColor("#222222")
DARKER_GREY = ManimColor("#222222")
PURE_RED = ManimColor("#FF0000")
PURE_GREEN = ManimColor("#00FF00")
PURE_BLUE = ManimColor("#0000FF")
PURE_CYAN = ManimColor("#00FFFF")
PURE_MAGENTA = ManimColor("#FF00FF")
PURE_YELLOW = ManimColor("#FFFF00")
BLUE_A = ManimColor("#C7E9F1")
BLUE_B = ManimColor("#9CDCEB")
BLUE_C = ManimColor("#58C4DD")
BLUE_D = ManimColor("#29ABCA")
BLUE_E = ManimColor("#236B8E")
PURE_BLUE = ManimColor("#0000FF")
BLUE = ManimColor("#58C4DD")
DARK_BLUE = ManimColor("#236B8E")
TEAL_A = ManimColor("#ACEAD7")
@ -164,14 +172,13 @@ GREEN_B = ManimColor("#A6CF8C")
GREEN_C = ManimColor("#83C167")
GREEN_D = ManimColor("#77B05D")
GREEN_E = ManimColor("#699C52")
PURE_GREEN = ManimColor("#00FF00")
GREEN = ManimColor("#83C167")
YELLOW_A = ManimColor("#FFF1B6")
YELLOW_B = ManimColor("#FFEA94")
YELLOW_C = ManimColor("#FFFF00")
YELLOW_C = ManimColor("#F7D96F")
YELLOW_D = ManimColor("#F4D345")
YELLOW_E = ManimColor("#E8C11C")
YELLOW = ManimColor("#FFFF00")
YELLOW = ManimColor("#F7D96F")
GOLD_A = ManimColor("#F7C797")
GOLD_B = ManimColor("#F9B775")
GOLD_C = ManimColor("#F0AC5F")
@ -183,7 +190,6 @@ RED_B = ManimColor("#FF8080")
RED_C = ManimColor("#FC6255")
RED_D = ManimColor("#E65A4C")
RED_E = ManimColor("#CF5044")
PURE_RED = ManimColor("#FF0000")
RED = ManimColor("#FC6255")
MAROON_A = ManimColor("#ECABC1")
MAROON_B = ManimColor("#EC92AB")

View file

@ -20,7 +20,7 @@ from manim import (
tempconfig,
)
from manim import CoordinateSystem as CS
from manim.utils.color import BLUE, GREEN, ORANGE, RED, YELLOW
from manim.utils.color import BLUE, GREEN, ORANGE, PURE_YELLOW, RED
from manim.utils.testing.frames_comparison import frames_comparison
__module_test__ = "coordinate_system_opengl"
@ -152,7 +152,7 @@ def test_gradient_line_graph_x_axis(scene, using_opengl_renderer):
curve = axes.plot(
lambda x: 0.1 * x**3,
x_range=(-3, 3, 0.001),
colorscale=[BLUE, GREEN, YELLOW, ORANGE, RED],
colorscale=[BLUE, GREEN, PURE_YELLOW, ORANGE, RED],
colorscale_axis=0,
)
@ -167,7 +167,7 @@ def test_gradient_line_graph_y_axis(scene, using_opengl_renderer):
curve = axes.plot(
lambda x: 0.1 * x**3,
x_range=(-3, 3, 0.001),
colorscale=[BLUE, GREEN, YELLOW, ORANGE, RED],
colorscale=[BLUE, GREEN, PURE_YELLOW, ORANGE, RED],
colorscale_axis=1,
)

View file

@ -226,7 +226,7 @@ def test_get_area(scene):
area2 = ax.get_area(
curve1,
x_range=(-4.5, -2),
color=(RED, YELLOW),
color=(RED, PURE_YELLOW),
opacity=0.2,
bounded_graph=curve2,
)
@ -266,7 +266,7 @@ def test_get_riemann_rectangles(scene, use_vectorized):
quadratic,
x_range=[-1.5, 1.5],
dx=0.15,
color=YELLOW,
color=PURE_YELLOW,
)
bounding_line = ax.plot(lambda x: 1.5 * x, color=BLUE_B, x_range=[3.3, 6])

View file

@ -26,7 +26,7 @@ def test_line_graph(scene):
first_line = plane.plot_line_graph(
x_values=[-3, 1],
y_values=[-2, 2],
line_color=YELLOW,
line_color=PURE_YELLOW,
)
second_line = plane.plot_line_graph(
x_values=[0, 2, 2, 4],
@ -71,7 +71,7 @@ def test_plot_surface_colorscale(scene):
param_trig,
u_range=(-3, 3),
v_range=(-3, 3),
colorscale=[BLUE, GREEN, YELLOW, ORANGE, RED],
colorscale=[BLUE, GREEN, PURE_YELLOW, ORANGE, RED],
)
scene.add(axes, trig_plane)
@ -151,7 +151,7 @@ def test_gradient_line_graph_x_axis(scene):
curve = axes.plot(
lambda x: 0.1 * x**3,
x_range=(-3, 3, 0.001),
colorscale=[BLUE, GREEN, YELLOW, ORANGE, RED],
colorscale=[BLUE, GREEN, PURE_YELLOW, ORANGE, RED],
colorscale_axis=0,
)
@ -166,7 +166,7 @@ def test_gradient_line_graph_y_axis(scene):
curve = axes.plot(
lambda x: 0.1 * x**3,
x_range=(-3, 3, 0.001),
colorscale=[BLUE, GREEN, YELLOW, ORANGE, RED],
colorscale=[BLUE, GREEN, PURE_YELLOW, ORANGE, RED],
colorscale_axis=1,
)

View file

@ -24,7 +24,7 @@ def test_become(scene):
.set_opacity(0.25)
.set_color(GREEN)
)
s3 = s.copy().become(d, stretch=True).set_opacity(0.25).set_color(YELLOW)
s3 = s.copy().become(d, stretch=True).set_opacity(0.25).set_color(PURE_YELLOW)
scene.add(s, d, s1, s2, s3)
@ -37,7 +37,7 @@ def test_become_no_color_linking(scene):
scene.add(b)
b.become(a)
b.shift(1 * RIGHT)
b.set_stroke(YELLOW, opacity=1)
b.set_stroke(PURE_YELLOW, opacity=1)
@frames_comparison

View file

@ -8,11 +8,11 @@ __module_test__ = "modifier_methods"
@frames_comparison
def test_Gradient(scene):
c = Circle(fill_opacity=1).set_color(color=[YELLOW, GREEN])
c = Circle(fill_opacity=1).set_color(color=[PURE_YELLOW, GREEN])
scene.add(c)
@frames_comparison
def test_GradientRotation(scene):
c = Circle(fill_opacity=1).set_color(color=[YELLOW, GREEN]).rotate(PI)
c = Circle(fill_opacity=1).set_color(color=[PURE_YELLOW, GREEN]).rotate(PI)
scene.add(c)

View file

@ -1,7 +1,7 @@
from manim.constants import LEFT
from manim.mobject.graphing.probability import BarChart
from manim.mobject.text.tex_mobject import MathTex
from manim.utils.color import BLUE, GREEN, RED, WHITE, YELLOW
from manim.utils.color import BLUE, GREEN, PURE_YELLOW, RED, WHITE
from manim.utils.testing.frames_comparison import frames_comparison
__module_test__ = "probability"
@ -69,13 +69,13 @@ def test_advanced_customization(scene):
chart = BarChart(values=[10, 40, 10, 20], bar_names=["one", "two", "three", "four"])
c_x_lbls = chart.x_axis.labels
c_x_lbls.set_color_by_gradient(GREEN, RED, YELLOW)
c_x_lbls.set_color_by_gradient(GREEN, RED, PURE_YELLOW)
c_y_nums = chart.y_axis.numbers
c_y_nums.set_color_by_gradient(BLUE, WHITE).shift(LEFT)
c_y_axis = chart.y_axis
c_y_axis.ticks.set_color(YELLOW)
c_y_axis.ticks.set_color(PURE_YELLOW)
c_bar_lbls = chart.get_bar_labels()

View file

@ -133,7 +133,7 @@ def test_SurfaceColorscale(scene):
u_range=[-3, 3],
)
trig_plane.set_fill_by_value(
axes=axes, colorscale=[BLUE, GREEN, YELLOW, ORANGE, RED]
axes=axes, colorscale=[BLUE, GREEN, PURE_YELLOW, ORANGE, RED]
)
scene.add(axes, trig_plane)
@ -158,7 +158,7 @@ def test_Y_Direction(scene):
)
surface_plane.set_style(fill_opacity=1)
surface_plane.set_fill_by_value(
axes=axes, colorscale=[(RED, -0.4), (YELLOW, 0), (GREEN, 0.4)], axis=1
axes=axes, colorscale=[(RED, -0.4), (PURE_YELLOW, 0), (GREEN, 0.4)], axis=1
)
scene.add(axes, surface_plane)

View file

@ -159,7 +159,7 @@ def test_AnimationBuilder(scene):
@frames_comparison(last_frame=False)
def test_ReplacementTransform(scene):
yellow = Square(fill_opacity=1.0, fill_color=YELLOW)
yellow = Square(fill_opacity=1.0, fill_color=PURE_YELLOW)
yellow.move_to([0, 0.75, 0])
green = Square(fill_opacity=1.0, fill_color=GREEN)