Added hsb() and rgb() helper functions#6021
Added hsb() and rgb() helper functions#6021brownian-motion wants to merge 1 commit intoprocessing:masterfrom
Conversation
|
Neat idea! If something like this was exposed (which I personally like, but I believe Ben is the decider on expanding the API) then personally I think it would make more sense to use signature overloading. That could be: ...but honestly, for consistency with the API I would instead have expected it to be a five-argument form of You can't have a 4-argument form for color, as those signatures for taken, but it would be simple and clear, and not require four new function names with four new references pages et cetera. It also might make sense to propose for Processing4 .... |
|
Thanks for the comment, @jeremydouglass ! I thought about signature overloading (favoring I also strongly considered |
for creating HSB and RGB colors in any color mode.
When using Processing, I frequently find myself wanting to create a color with a specific hue, saturation, or brightness while in RGB mode. For example, when creating random colors, I often found myself writing something like:
but this produces bright and dark colors, as well as vibrant and dull colors. What I really wanted was
a color with a random hue, like so:
but frequently had to achieve this by "switching modes" halfway through a program:
This PR adds the helper functions I've wanted for so long, to be able to create an arbitrary color in either color space, without having to switch color modes before/after the call.