Little tip for separating RGB values on the colorchooser #271
Valenterie
started this conversation in
Showcase
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey ! Don't know if it's the best place to put that, but I think it's kinda helpful.
I was trying to take the RGB values of my colorchooser and found the solution :
When you pick a color, the RGB values are all put in the same part of the list (the first element, [0] ) and for my project, I had to put them separately, so here's what to do. Thanks to strip(), we can delete any character we want, so we delete the parenthesis. Then, with split() we can put the string into a list separated with certain elements, for this case, "," and " ".
ALSO, if you don't want those infinite float values for RGB colors, you can go to the source code of the colorchooser (colorchooser.py) and change the output (line 52) of the RGB values and put them into int() values like so :
If you have any other ideas, feel free to share your experiments here !
Beta Was this translation helpful? Give feedback.
All reactions