How to insert colourMode()s into stroke and fill


#1

Sorry if this is a dumb question, I’m pretty new at this. I would like to insert different colourMode()s into the actual stroke and fill command of a specific shape. How can I do this? Following the instructions on the page just gives me a square of that colour in the top left corner of my window. Thanks.


#2

Hi,

What do you mean by inserting different color mode to a stroke ?

A color mode is a way to “classify” the colors. With RGB this is done by giving 3 numbers: the red intensity, the green intensity and the blue intensity. It is good for computer since they are using red, green and blue pixels but not really good for us human. So we created other ways to sort colors that would speak a bit more to us. This is the case for HSB for example where a color is determined by the hue (the color), the saturation (how intense the color looks) and the brightness (how white or dark it is).

You can’t use several one for a stroke. You just decide which langage you want to speak but you can’t speak several at the same time.

If what you mean is give the user the possibility to choose either the RGB values or the HSB values, then you need to look online for some conversion formulas.


#3

I’m seeing how I went wrong with my explanation, but I would like to get the actual gradient colours used in those lines of code. I mistook the colourMode() for the actual code to insert the colour.

I would just like to figure how to actual insert the gradients, that are seen under the colourMode(), into the shapes that are being drawn


#4

Were you able to resolve this issue? There are a number of ways to approach this problem – including with vertex coloring in PShape, with a PShader, or with a image mask.