Solve It
In this example we want to turn the Duke Blue pixels of the Duke logo yellow. Since only the white pixels have a red value of 255, we can use that condition in our if statement to identify the pixels we want to change. To turn the pixel yellow, we set its green and red values to 255 and blue value to 0.
Code It
// blue to yellow
var image = new SimpleImage("duke_blue_devil.png");
for (var p of image.values()) {
if (p.getRed() != 255) {
p.setRed(255);
p.setGreen(255);
p.setBlue(0);
}
}
print(image);
See It
Available Images

duke_blue_devil.png
[397x337]
Drop your images onto the area above to make it available within your code editor on this page. Note: your images will not be uploaded anywhere, they will stay on your computer.
