Support hex color strings in color functions
Given the primacy of hex color values on the web, I'd like to propose enhancing fill, background and the other color-related methods to be able to take a hex value string in addition to the RGB color values or color array. This will make it easier to integrate other JS color libs into p5, because almost all of them are able to spit out hex values one way or another.
Example:
// same:
fill( '#45ab31' );
fill( 69, 171, 49 );
Ah yes! This was on my radar! I think it makes total sense. Some people in the workshop even expected to be able to type CSS strings like 'red' into the functions. I really liked that idea.
yes!
Yes this would be great! And bring it more inline with processing.
@evhan55 points out that we're setting the returned value from getNormalizedColor and getCSSRGBAColor directly onto the canvas context, and the canvas context speaks CSS color strings. Passing strings like 'red' or '#45ab12' directly through should work. I am updating the patch.
But what if I do:
var c = color("pink");
...
int red_value = red(c);
Hi, I am Hrishit. New to this project and I was looking at the issues to find out where I can start. I would like to work on this one. Does it make sense as a beginner?
I know @kadamwhite started on this, not sure where it's at right now, but he could probably say better whether it's at a point someone could jump in.
@hrishit if you are looking for a self-contained issue to start with, maybe this one? https://github.com/lmccart/p5.js/issues/226
@hrishit Lauren's correct, I worked on this a bit in #223 and some of the work from that branch is salvageable; I've just not had the time to finish it up since then :) I've been working to update my patch for all the changes that have happened since June, and will hopefully have more to show for it soon; if you have a solution, though, don't let me hold you up!
@kadamwhite just wanted to confirm before starting on this one. Knowing that you are working on it I've already started on #226. Nevertheless please let me know if you need any helping hand.
yeah, sorry @kadamwhite, had to rework things a bit when I started hitting some real performance issues. let me know if you have any questions about how things are laid out now, happy to walk you through it.
:))