Hi guys I’m hoping you can help please I’m a bit stuck.
When trying to convert my code to a library I ran into the following problem, color is not recognised as a data type
.
I have found the following posts online asking about the same problem and most of them recommend using int
instead of color
, which I’m still a bit confused about because when I tried this it did not resolve the problem.
as you can see. Its likely I’m missing something obvious but I simply do not know what I’m looking to do. An int in my understanding is a datatype that only accepts one value not 2, 3 or 4 as color does. So how do I use int to handle the color type.
I have found an alternative which is the java.awt
library which has a Color class, and has functions such as getRGB()
etc to extract values, but I’m just wandering if this method has any problems as it means amending my library which at this point has quite a few instances of color.
here is a sketch using awt
import java.awt.*;
void setup(){
};
void draw(){
Color c = Color(255, 0, 255);
background(c.getRGB());
};
Many thanks guys