class Box { int boxWidth; int boxHeight; int boxNum; boolean rgb = true; //constructor Box(int bWidth, int bHeight, int bNum) { boxWidth = bWidth; boxHeight = bHeight; boxNum = bNum; } void display() { for (int i = 0; i < boxNum; i++){ noStroke(); //get random color from image and draw box color c = colors[i]; fill(c); rect(500, boxHeight*i+60, boxWidth, boxHeight); //determine and print RGB values in black box float r = red(c); float g = green(c); float b = blue(c); fill(0); rect(500, boxHeight*i+106, boxWidth, boxHeight/3); fill(255); if (mode == 1) { text("RGB: " + r + " | " + g + " | " + b, 505, boxHeight*i+120); } else if (mode == 2) { //int hexValue = int(hex(c)); text("Hex: #" + hex(c,6), 505, boxHeight*i+120); } } } }