Source
manim/utils/color/core.py, line 964 (as of HEAD ):
@staticmethod
def gradient(
colors: list[ManimColor], length: int
) -> ManimColor | list[ManimColor]:
"""This method is currently not implemented. Refer to :func:`color_gradient` for
a working implementation for now.
"""
# TODO: implement proper gradient, research good implementation for this or look at 3b1b implementation
raise NotImplementedError
Problem
ManimColor.gradient() is exposed as a public static method with a documented signature and return type, but calling it raises NotImplementedError. Users discovering the method via IDE autocomplete or API docs will be misled. The docstring currently redirects to the module-level color_gradient function as a workaround, but the method itself remains a public API gap.
Suggested approaches
- Implement the method using the same logic that
color_gradient already provides, then have color_gradient delegate to it (or deprecate the function in favour of the method).
- Reference the 3b1b/manim implementation as a starting point, as the original TODO suggests.
- Add tests that exercise the method with edge cases (length 0, length 1, single-colour input, colours with alpha).
Source
manim/utils/color/core.py, line 964 (as of HEAD ):Problem
ManimColor.gradient()is exposed as a public static method with a documented signature and return type, but calling it raisesNotImplementedError. Users discovering the method via IDE autocomplete or API docs will be misled. The docstring currently redirects to the module-levelcolor_gradientfunction as a workaround, but the method itself remains a public API gap.Suggested approaches
color_gradientalready provides, then havecolor_gradientdelegate to it (or deprecate the function in favour of the method).