RGB pixel
block takes three numbers as input and reports a list with the those three color values.A list is an ordered sequence of items.
You've seen a list before when you selected random items from lists in the Super Short Story project:
The output of random job
was a random item from the list of jobs.
The output of RGB pixel
is a list of three values: the amount of red, green, and blue for one pixel.
draw pixel
block in the palette, drag it into the scripting area, snap the RGB pixel
block into the open input slot, and run the script to draw a pixel with those color values.RGB pixel
block inside draw pixel
, and see how it changes the pixel drawn on the stage.paint color from pixel
block takes two inputs, a list of RGB color values and a resolution, and it paints a grid of pixels on the stage with those color values at that resolution. Find the paint color from pixel
block, and build and run this script.RGB pixel
block inside paint color from pixel
.
paint color from pixel
block ?
These aren't really pixels but are instead models of pixels made to show how pixels blend to make colors. They are only a third as bright as real pixels because the real pixels that display these model pixels on your screen each include only a third of their total possible brightness. (Real white pixels have 100% red, 100% green, 100% blue not just 100% red but no green or blue near a pixel with 100% green but no red or blue and a pixel with 100% blue but no red or green.)
This project also includes a block that doesn't use model pixels at all and instead paints with the real RGB colors. Try it out. How can you make white or another light color?
Why do RGB colors mix differently than paint?
You might be familiar with subtractive color mixing where the primary colors are red, yellow, and blue and you can get secondary colors by mixing red and yellow to make orange, yellow and blue to make green, and red and blue to make purple. Mixing paints is subtractive color mixing, but mixing light (like the images on a screen) is additive color mixing. In additive color mixing, the primaries are red, green, and blue, and the secondary colors that you get by mixing equal parts of the primaries are yellow, cyan, and magenta.
Additive color mixing (like on a screen) is called additive because you start with no light and add light to get colors. Subtractive color mixing (like with paint) is called subtractive because you start with white light (which includes all the colors), and the paint absorbs (takes away) all the colors except the one reflected back to your eye. (For example, when white light hits red paint, all colors are absorbed except red.)
More optional reading: What Is the Difference Between Additive and Subtractive Color Mixing?
RGB pixel
block as the input to the draw pixel
block, and experimented with RGB color mixing.