-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code Mobject incorrect color string parsing #4104
Comments
I'm having the same problem on my m1 mac with macos 15.1.1 with a fresh install of manim, which is why I'm still using the docker image on tag v0.18.0 (probably the same version the containers on mybinder.com are running, because the interactive example in the docs is still working) |
I also faced this issue, and it was caused by this commit (pygments/pygments@0853028), release with Pygment 2.19. Pinning |
Thanks @jeertmans , pinning pygments solved it! |
@marcel-goldschen-ohm I don’t think you should close this issue, as it is still a bug (to me) that must be fixed on Manim’s side :) |
Sounds good, reopened. |
Description of bug / unexpected behavior
Code Mobject does not work for me at all in fresh install of mania v0.18.1. Throws ValueError due to attempt to parse an invalid color string. I tracked the issue down to the HTML/JSON for the code text which appears to be specifying at least some colors using shorthand notation (e.g., "#C93" instead of "#CC9933"). In the case of the shorthand, the color string still includes the next three characters which results in an invalid color string.
Fix
A quick fix is to see if the next character is a '"' as the HTML would be something like color="#C93", and if so convert from shorthand to the full correct color string. In
code_mobject.py
just after the color is parsed on lines 477-479:, the following insert after the above code fixes this aberrant behavior:
I'm a bit weirded out that this problem seems to have suddenly arose for me, so although the above fix does fix the issue, I'm wondering if there is something else going on? Also seems like a better solution would be to check for this in the color utils and handle it there so it is not just fixed for the Code Mobject.
Expected behavior
No errors.
How to reproduce the issue
Just attempt to instantiate a Code mobject. e.g.,
Logs
Terminal output
System specifications
System Details
python/py/python3 --version
): 3.12.8pip list
):The text was updated successfully, but these errors were encountered: