class ColoredScrollingItem { String title; PImage img; float x; float y; color col; // Creates new ColoredScrollingItem. ColoredScrollingItem(String title, PImage img, float x, float y) { this.x = x; this.y = y; this.title = title; this.img = img; // Selects color from pixel at image center point this.col = img.get(img.width/2, img.height/2); // If selected color is too dark, take white instead if (brightness(this.col) < 30) { this.col = color(255); } } // Displays image and colored title. void display() { image(img, x, y); fill(col); text(title, x + 90, y + 40); } // Scroll item, i.e. change vertical position a little bit. void scroll() { y = y + 0.3; if (y > height) { y = -img.height; } } }