(Redirected from Set Pen Color to () (blocks))
|Set Pen Color to ()|
- "Set Pen Color to ()" redirects here. For the block with a number input, see Set Pen Color to () (number input block).
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.
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:
- 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.
The block also supports hexadecimal inputs for colors (000000 - ffffff).
define set pen color hexadecimal [hex value] set pen color to (join [0x] (hex value))
- Set Pen Color to () (number input block)
- Change Pen Color by () (block)
- Color Picker
- Pen Color (value)