Color as a List

You might have noticed the built-in blocks palette called Colors. In it are 13 color blocks, which make setting the colors of background and buttons in code blocks quick and easy. But the really interesting part is at the bottom of the palette: the make color block (see Figure 6.16).

Image

Figure 6.16 Making a custom color out of a list. This one has red at maximum and blue and green at zero. The color will be red.

Colors in App Inventor are really just lists. These lists must have exactly three items in them, and those items must be numbers, which specify the red, green, and blue parts of the color. Using the make color block, you ...

Get Learning MIT App Inventor: A Hands-On Guide to Building Your Own Android Apps now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.