You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss
8000
alert
I’m openning this issue because I didn’t found any mention of this in the documentation in the page implementation-notes from the library.
There is an existing library colorsys in cpython with the methods named hls_to_rgb or hsv_to_rgb and the developper might be tempted to believe that the code running in cpython could run in circuitpython in the same way.
This is wrong : the functions in cpython returns a float with a range from 0…1 where circuitPython return an int between 0…255.
Could you at least add a caveat in the documentation in order to rise the attention on this point ?
The text was updated successfully, but these errors were encountered:
Looking back at the original commits for this library it looks like it was originally taken from the cpython implementation and then with the next commit changed to 0-255 ints:
Instead of adding a warning in the implementation notes, I'd be in favor of changing the functionality to match cpython and return floats instead. If application code needs int colors they could convert it outside of this module so that we can keep compatibility to a maximum where possible.
Hello, I didn’t propose a change in the library itself because it would break the existing code using it. ( I can’t resist to insert an xkcd reference here )
However, this is my personnal point of view, and if you are willing to change the behavior itself, please do :)
That is true, and I'll definitely get input from the wider team.
I had a look around for usages in the most prominent places as well. In all of the Learn Guide repo, as well as all Library examples within the bundle there are two usages of colorsys but both appear to be within the context of CPython rather than CircuitPython:
Hello,
I’m openning this issue because I didn’t found any mention of this in the documentation in the page implementation-notes from the library.
There is an existing library colorsys in cpython with the methods named
hls_to_rgb
orhsv_to_rgb
and the developper might be tempted to believe that the code running in cpython could run in circuitpython in the same way.This is wrong : the functions in cpython returns a float with a range from 0…1 where circuitPython return an int between 0…255.
Could you at least add a caveat in the documentation in order to rise the attention on this point ?
The text was updated successfully, but these errors were encountered: