Skip to content

Fix scalar color type hints for FadeIn and FadeOut#2567

Open
Sev7een wants to merge 1 commit into
Zulko:masterfrom
Sev7een:fix_fade_color_type_hints
Open

Fix scalar color type hints for FadeIn and FadeOut#2567
Sev7een wants to merge 1 commit into
Zulko:masterfrom
Sev7een:fix_fade_color_type_hints

Conversation

@Sev7een

@Sev7een Sev7een commented May 31, 2026

Copy link
Copy Markdown

Summary

  • allow FadeIn.initial_color and FadeOut.final_color to be typed as scalar floats for mask clips
  • keep tuple and list color support explicit for regular clips
  • add regression coverage for scalar mask fade colors and their public type hints

Root cause

Both effects already support scalar colors at runtime because they convert the provided color with numpy.array. Their docstrings also document scalar mask colors, but the dataclass annotations only allowed list. As a result, valid calls such as FadeOut(duration, final_color=0.0) were rejected by static type checkers.

Closes #2472

Validation

  • python -m pytest tests/test_fx.py -q -k "fadein or fadeout"
  • python -m pytest
  • python -m pytest --doctest-glob "moviepy/**/**.py"
  • black --check --diff --color .
  • isort --check-only --diff moviepy docs/conf.py examples tests
  • flake8 -v --show-source --ignore=E501 moviepy docs/conf.py examples tests

AI assistance disclosure

This contribution was prepared with Codex assistance. The final diff and validation results were reviewed locally before submission.

Copilot AI review requested due to automatic review settings May 31, 2026 04:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bad type hint for final_color

1 participant