look() / peek()

The look and peek functions return color information from a particular position on the screen. They are very similar. With look(), the return value is a string. With peek, it's an object called a hash that breaks out the red, green, and blue values.

Here's a sample of using look. Tapping on the spectrum draws lines of different colors on the screen. You can also see what the return value of look() is in the upper right of the screen each time you tap.

Here's an example of how you might use peek.

This example shows all of the different bits of information you get back when you call peek().