Colorunder

colorunder

Reports the color under the current turtle as a number. The portion of a turtle that recognizes a color is its center. Colorunder reports the background color as well as all the drawings.

Example:

t1, show colorunder

3

In a stop rule, always use the color number, not its name, to check the color under the turtle:

if colorunder = 15

[announce [You win!]]

Colorunder reports not only integers but also decimal numbers. Note that when MicroWorlds reports decimal numbers, it may report a slightly different number than the one expected. This is due to the recalculation of the RGB color.

setc 105.6

fill

show colorunder

105.4

setc 17.2

fill

show colorunder

17.1