Closed leotrs closed 3 years ago
Good suggestion. Would love to see a PR of that. However, I'm not convinced of the usefulness of that :
A next step would be to implement a ColorTheme class that allows the user to do things such as ColorTheme.interpolate("text_color", "background_color", 0.5) to get a colour that is halfway between two pre-defined colors.7
I don't think the standard user will ever use that, as this can be done quite easily with the utils or by hand, adding this to ColorTheme
would be too much and don't fit in such class.
I'd love to see other's opinion, who have certainly way more experience than me in manim projects.
Yeah you're right, I think this suggestion should just add lists/dicts containing a bunch of harmonizing colors. The ColorTheme suggestion is probably useless/bloatware.
Closing in favor of #279
Color themes would allow the user to change all colors in a scene by changing just one line of code. A theme could be as simple as just a list of pre-defined colors. For example:
Here,
colors.some_theme_name
could really just be the list["RED", "GREEN", "BLUE"]
. But then if there was another theme defined ascolors.some_other_theme = ["BLACK", "ORANGE", "BROWN"]
, changing all three colors throughout the scene could be done in a single line of code.Note that this is already feasible on the user side. A user may define their own list of colors, and swap them as they see fit. What I'm suggesting is that manim should ship with a few of these pre-defined. For example, if the user wants their video to look like 3b1b's videos, they could use a pre-defined
colors.theme_3b1b
. Or if they want their videos to look different, they could use a different pre-defined, or user-defined theme.Implementing them as lists would be extremely easy. However, we could also provide more complicated pre-defined themes using dictionaries, that make use of meaningful keys such as
theme["text_color"], theme["graph_color"], theme["background_color"]
, and so on.A next step would be to implement a
ColorTheme
class that allows the user to do things such asColorTheme.interpolate("text_color", "background_color", 0.5)
to get a color that is halfway between two pre-defined colors. (Note this is currently possible withmanim.utils.color.interpolate_color
, so implementing such a class would be mostly a matter of refactoring.) A next NEXT step would be to implement something likeScene.register_color_theme(ColorTheme)
which would automatically convert the color of everyTextMobject
toColorTheme["text_color"]
, or something along those lines.What do y'all think? I think we could easily start by providing pre-defined themes that are just lists.