-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Attempt to implement a theming concept #2015
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
Conversation
background color be set by theme
- placed functions on top - if a theme is used, greyscale is take as gradient
for more information, see https://pre-commit.ci
This reverts commit 5be28dc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your work so far! I don't think redefining the grayscale gradient is a very good implementation of themes however. Right now, it seems like there are many places in which the colors of mobjects
are hardcoded; for example, WHITE
by default, RED
for Circle
, BLUE
for polygrams, etc. It seems like a better approach to generalize this to something like MOBJECT_COLOR_A
, MOBJECT_COLOR_B
or THEME_COLOR_A
, THEME_COLOR_B
for example. These can be defined in a constants file like theme_sepia.py
for example, and imported when the scene is set (perhaps you can make the theme a property of Scene
, so that it can be changed in the middle of the scene). This can also easily be generalized for Axes
, FunctionGraph
, and so on. I'm not sure how the background_color
code works but I'm guessing it can also be implemented with this approach. It seems like this approach will allow significantly more flexibility, if possible.
This is true, but there were never complaints abt this before theming.
That's fair. I can try that.
I don't think this is possible. I've experimented enough to understand that the initialization of the mobjects occur at the line The whole idea clearly needs way more discussion. Until we can reach a general consensus, this should stay a draft. |
I think there are multiple closely related design questions that are related to this PR. Obviously, one is whether a theme system makes sense for the library – but I don't really want to get into that with this comment. I do want to bring attention to this suggestion made a while back on our Discord regarding an idea to make the Mobject default arguments customizable. Personally, I believe it would be desireable to provide users with an easy way of customizing the default color assigned to a particular Mobject class. Practically, this could be done by modifying a static attribute like >>> c1 = Circle()
>>> c2 = Circle(color=GREEN)
>>> Circle.config.color = PINK
>>> c3 = Circle()
>>> c4 = Circle(color=GREEN) the colors are set as expected. The advantage of an approach like this would be that modifications to the default colors can also happen during runtime, the obvious disadvantage is that it is more difficult to get right. In this model, a particular theme would likely be a dictionary mapping Mobject classes to colors (plus a mechanism for the background color) – although I can also see the merit for setting the color of all mobjects simultaneously. |
It's be great if the themes are modular, so there can be a repository of many awesome themes designed by the community :) |
Closing this in favor of first discussing how to go about implementing such a feature |
Overview: What does this pull request change?
This PR aims to implement a 'color theme' into manim.
Concerns:
MOBJECT_COLOR
Any and all opinions are welcome.
Motivation and Explanation: Why and how do your changes improve the library?
A light mode theme:



A sepia theme:
A seagreen theme:
Links to added or changed documentation pages
Further Information and Comments
Reviewer Checklist