-
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
ManimColor: Adding documentation and examples for creating colors #3472
Comments
That None is indeed not a bug and currently just for not needing to rewrite the whole library it just returns BLACK if you give it The reason for you needing to convert to hsv before you can access the values is that the internal representation is now in rgba of floats which is more in line of how the color is handled in rendering. If HSL is missing i think i just forgot that, we just need to add another conversion function The problem with giving attributes for accessing colors in different formats is that you will cause a wave of conversions for every time you do that and it slowed down manim a lot when handling a lot of colors that change. New examples seem like a good idea but it would probably just be showing every method once that is already documented on the ManimColor page, if you have any ideas on how to do that in a useful way i would be happy to do something about it. In general if you want to create colors from hsv then you just use the static function from_hsv that gives some more work to the user but avoids a lot of unnecessary copying and conversion for no other reason than the user used the color. |
And to answer your original question >>> hsv = ManimColor.from_rgb(None).to_hsv()
>>> hsv
(0.0, 0.0, 0.0)
>>> hsv = ManimColor(None)
>>> hsv
ManimColor('#000000') None doesn't mean Nothing |
Ah ok, I got it. So one must consider a class ref, not a class instance, e.g. this:
instead of this:
That does not appear anywhere in the docs, and a user is not supposed to dig into the source code. Overall, I think that the documentation shall be updated because it is very confusing if it is intended to be for the final user. For example, the fact that ManimColor shall be referred as a class ref and not as a class instance is paramount to be documented, whereas info like the following:
has of little - if none - utility for the users. Furthermore, the following, other than being poorly documented, is also wrong:
For example, |
These methods are all listed as class methods, the information is there. Oneline examples of how to call them would be nice though. Suggestions for how to make the distinction between class and instance methods more visible are welcome too. |
I would do the following way:
and therefore, calls like
|
This is not the case. The class methods (which examples could be added to) are an additional interface for creating instances. Based on RGB values, you can still create an object in the conventional way via
I am not sure I agree with the complete removal; there is information relevant for devs that needs to be put somewhere too; docstrings are not purely user-facing features.
I agree, that is not difficult to change. We should investigate whether there was a particular reason why this was enabled.
Contributions and improvements to the documentation are welcome!
The signature is listed twice because there are two different return types, Sphinx generates it like that. Not sure we have much more control about how exactly this is displayed. |
I am just giving a feedback as end-user if that count as contribution. :-) I had really hard time in understanding this page compared to many other pages in the docs. Also the usage could be clarified. Is it good to use in a production environment? Or is it a sort of experimental open lab to practice coding? I think it is about time to write down Vision and Mission? :-) Bottom line: |
So i would now word it a bit different because saying something like it has no utility for the user is really trashing the whole picture why this change was made in the first place. Yes it has utility for the user even if you do not see it directly, render times are reduced, many errors have been solved, color shifting due to the constant conversions has been completely removed as a problem. So please do not go around and say something like it has no utility for the user if you're seeing a tiny part of it. Next point is, yes it is kind of an expectation that you read the documentation and if you do not understand something then you're able to look up why it may not work or ask on discord. Because personally i think the documentation is pretty clear on which functions are class functions and which are not. And if you say things like time to write down a mission please join us in the discord and become a dev and actually look at what is done behind the scenes, because there are clear goals for the library And lastly i would also suggest to you that you first think about multiple stand points for which things might be used because just having one perspective really shifts the reality of the situation, so keep answers short and useful and provide use cases and information that is relevant to the dev process instead of using exaggerations in every sentence. Thanks for your suggestion |
I understand now issues related to the remaining points. Thanks. |
Time to work with colours! :D
will return
TypeError: ManimColor.__init__() missing 1 required positional argument: 'value'
, whereas the docs sayIs that
None
a "docs' bug"?Questions:
hsv = ManimColor(...
, wouldn't be nicer to access attributes e.g. withhsv.hue, hsv.saturation‚ hsv.value
rather than using the.to_hsv()
method?hsl
color space has been removed, is there any special reason?Keep up the good work !
The text was updated successfully, but these errors were encountered: