Box colorBox; Button button1, button2, button3; ColorGen colorGenerate; PFont font; PImage img; //number of colors swatches int colorNum = 10; //swatch properties int boxWidth = 150; int boxHeight = 66; //color array int[] colors = new int[colorNum]; //mode for RGB/hex, 1 = RGB, 2 = hex int mode = 1; float imgWidth; float imgHeight; void setup() { size(650, 717); background(0); smooth(); //load font font = loadFont("Helvetica-Bold-10.vlw"); textFont(font); //load image and store width and height img = loadImage("coffee.jpg"); imgWidth = img.width; imgHeight = img.height; image (img, 0, 0); //instructions fill(0); rect(0, 667, 500, 50); fill(255); text("COLOR BUDDY: Ten colors are randomly selected from the loaded image and displayed in the right column with their corresponding RGB values. To change a color, click on the color swatch you wish to change and click on the image.", 5, 675, 500, 50); //determine colors colorGenerate = new ColorGen(colorNum); colorGenerate.generate(); //load initial color display colorBox = new Box(boxWidth,boxHeight,colorNum); colorBox.display(); //load RGB and Hex buttons button1 = new Button(500, 0, 75, 30, "RGB", 1); button2 = new Button(574, 0, 75, 30, "Hex", 2); button3 = new Button(500, 30, 149, 29, "Reload Colors", 0); } void draw() { manageButtons(); } void manageButtons() { button1.update(); button2.update(); button3.update(); button1.display(); button2.display(); button3.display(); } void mousePressed(){ if (button1.press() == true) { mode = 1; colorBox.display(); } if (button2.press() == true) { mode = 2; colorBox.display(); } if (button3.press() == true) { colorGenerate.generate(); colorBox.display(); } colorGenerate.press(); }