Skip to content

Type annotation for color parameter in indication animations (e.g., Flash, Indicate) does not match actual supported types #4421

@Xpectuer

Description

@Xpectuer

Description of bug / unexpected behavior

The type annotation for the color parameter in several indication animations (e.g., Flash, Indicate) is str, but the actual implementation and usage support both str and ManimColor (e.g., Color, BLUE, custom color objects). This causes type checkers (like Pyright/mypy) to report type errors, even though the code runs fine.

Expected behavior

The type annotation for color should match the actual supported types (e.g., str | ManimColor or ParsableManimColor), so that type checkers do not report false positives and the documentation is accurate.

How to reproduce the issue

Code for reproducing the problem
from manim import *

class TestFlash(Scene):
    def construct(self):
        dot = Dot()
        self.add(dot)
        self.play(Flash(dot, color=BLUE))  # No runtime error, but type checker complains

Additional media files

Images/GIFs

Logs

Terminal output
Argument of type "Color" cannot be assigned to parameter "color" of type "str" in function "__init__"

System specifications

System Details
  • OS: macOS 15.6 (Build 24G84)
  • RAM: 8 GB
  • Python version: Python 3.12.11
  • Installed modules(uv):
"manim>=0.19.0",
"jsonschema>=4.23.0",
"manim-position-system", # a local module
LaTeX details
  • LaTeX distribution (e.g. MacTeX 2025):
  • Installed LaTeX packages: NO NEED

Additional comments

This is a type annotation/documentation issue. The runtime works fine, but type checkers and IDEs report errors. Please consider updating the type annotations for color in these classes to match the actual supported types.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    🆕 New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions