(Redirected from Eng:Set Pen Color to () (block))
|Set Pen Color to ()|
The Set Pen Color to () block is a Pen block and Stack block. The block sets the pen's color to the color chosen with the block's color-picker (eyedropper tool). To select a color (in the non-value-entry block), one must click on the color box and then click anywhere in the Scratch program to change the color with the eye-dropper. A 200 pen color value is the same color as a 0 pen color value; in other words, if you change the pen color by 200, the color still looks the same.
As this block can change the pen's color, it is mainly used when the pen is drawing something and a different color is desired.
Some common uses for the Set Pen Color to () block are:
- Choosing the chosen color in paint projects
set pen color to (13) repeat until <not <mouse down?>> go to [mouse-pointer v]
- Creating different objects by using different pen colors (such as a tile that can be colored to look like ice or fire)
set pen color to [#5af329] repeat (360) move (1) steps turn cw (1) degrees end
- Choosing the color of objects drawn by the pen
set pen color to [#c3e452] repeat until <not <mouse down?>> go to [mouse-pointer v] end
In Scratch 1.4, when the color box within the non-value-entry block was clicked, a color palette would appear with all the hues, in which one could choose the color from. In Scratch 2.0, though, one must use the eye-dropper tool (when one selects a color designated at a specific pixel) and can only select a color that is visible on the screen of the Scratch program. Therefore, a workaround for obtaining a specific color from the color palette as in Scratch 2.0 is to go into the paint editor, draw the color you want onto the sprite, and pick that color from the block. Make sure that the sprite is showing, though you can remove the drawn color afterwards with the undo key in the Paint Editor.
One of Scratch 2.0's secrets is that the color box allows a reporter block to be inputted. In this case, when the block runs, the color will be set to the RGB value of the reporter. This situation can be replicated with the following custom block:
define set RGB red (value1) green (value2) blue (value3) set pen color to ( ( ( (value1) * (65536) ) + ( (value2) * (256) ) ) + (value3) )
ARGB is a formula for transparent pen that can be seen here.