class ColorPicker { int x,y; int w = 10; int h = 10; boolean select=false; PImage pallette = loadImage("pallette.png"); color c; String name; public ColorPicker(int x,int y, color c,String name){ this.x = x; this.y = y; this.c = c; this.name = name; } public void display(){ if(select){ image(pallette,x-pallette.width,y); } if(isOver()){ stroke(50); }else{ stroke(100); } if(select){ loadPixels(); fill(pixels[mouseX+mouseY*width]); }else{ fill(c); } rect(x,y,w,h); fill(0); text("= "+name,x+w+4,y+8); if(select){ cursor(CROSS); } } public boolean isOver(){ return mouseX>=x&&mouseX<=x+w&&mouseY>=y&&mouseY<=y+h; } }