筆跡顏色設為 (13) 筆跡顏色設為 [#5af329]
The Set Pen Color to () 积木 is a 画笔类积木 and 条形积木. The 积木 sets the 笔迹颜色 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
筆跡顏色設為 (13) 重複直到 <<滑鼠鍵被按下？> 不成立> 定位到 [滑鼠游標 v] 位置 end
- Creating different objects by using different pen colors (such as a tile that can be colored to look like ice or fire)
筆跡顏色設為 [#5af329] 重複 (360) 次 移動 (1) 點 右轉 @turnright (1) 度 end
- Choosing the color of objects drawn by the pen
筆跡顏色設為 [#c3e452] 重複直到 <<滑鼠鍵被按下？> 不成立> 定位到 [滑鼠游標 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 像素) 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 绘图编辑器, 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 绘图编辑器.
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:
定義 set RGB red (value1) green (value2) blue (value3) 筆跡顏色設為 ((((value1) * (65536)) + ((value2) * (256))) + (value3))
ARGB is a formula for transparent pen that can be seen here.