Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Pen colors?
- teresabeckham
-
2 posts
Pen colors?
Ok, I am fairly new to Scratch but have a big issue. I want to be able to input the # for the color into the “change pen color to” script, but can't find a list of pen colors.. can anyone help me? ( I know how to click and change the pen colors, but, wanted to be able to do it with numbers!) Thanks!
- deck26
-
1000+ posts
Pen colors?
Does the color picker on this page help - http://html-color-codes.info/
There are two color select options for the pen - one will work with numbers based on the RGB codes but the other won't. I think it's the one that is normally setting the color by selecting with the dropper which will accept the RGB number but try both if need be.
There are two color select options for the pen - one will work with numbers based on the RGB codes but the other won't. I think it's the one that is normally setting the color by selecting with the dropper which will accept the RGB number but try both if need be.
- streamline1
-
79 posts
Pen colors?
Correct me if I'm wrong, but I don't think that Scratch accepts hexadecimal or RGB colors.
Thanks!
Thanks!
- DadOfMrLog
-
1000+ posts
Pen colors?
If you use the correct “set pen color” block then, yes, it does - even including alpha transparency. Correct me if I'm wrong, but I don't think that Scratch accepts hexadecimal or RGB colors.
This post will hopefully help explain it: https://scratch.mit.edu/discuss/post/1008848/
Last edited by DadOfMrLog (July 29, 2015 20:16:50)
- TheLogFather
-
1000+ posts
Pen colors?
Having said the above, I just realised that the original poster may find it useful to have an explanation of the way the other “set pen color” block works (the one that lets you type numbers, not the one with the colour-picker square)…
The main thing to understand is the way that colour-spaces work. The RGB colour-space mentioned above works by specifying three components of colour: red, green and blue (hence RGB). Each component can take a value from zero to 255, so mixing these together gives the full range of ~16 million colours (256*256*256). All three set to zero gives black, while all three set to 255 gives white.
The other “set pen color” block (i.e. NOT the one with the colour-picker) is working, alongside the “set pen shade” block, within a different colour-space. That colour-space is known as HSL, for “Hue, Saturation, Lightness”.
The “set pen shade” block is setting the “L” component - the lightness, while the “set pen color” block is setting the “H” component - the hue. Unfortunately, Scratch does not provide a block to set the pen saturation (which means you cannot get a grey colour using just those two blocks - you have to use the colour-picker block.)
The hue in Scratch goes round a cycle from zero to 200 as follows:
red (zero) -> yellow (33) -> green (67) -> cyan (100) -> blue (133) -> magenta (167) -> back to red (200 = 0).
If you want to understand more about how the HSL colour-space works, see this wikipedia page: https://en.wikipedia.org/wiki/HSL_and_HSV (you'll see that, traditionally, the hue is given as angle from zero to 360 degrees, so the way that Scratch makes it go from zero to 200 is rather at odds with that…
)
You might also find this project useful: https://scratch.mit.edu/projects/62752782/
Hope that helps!
The main thing to understand is the way that colour-spaces work. The RGB colour-space mentioned above works by specifying three components of colour: red, green and blue (hence RGB). Each component can take a value from zero to 255, so mixing these together gives the full range of ~16 million colours (256*256*256). All three set to zero gives black, while all three set to 255 gives white.
The other “set pen color” block (i.e. NOT the one with the colour-picker) is working, alongside the “set pen shade” block, within a different colour-space. That colour-space is known as HSL, for “Hue, Saturation, Lightness”.
The “set pen shade” block is setting the “L” component - the lightness, while the “set pen color” block is setting the “H” component - the hue. Unfortunately, Scratch does not provide a block to set the pen saturation (which means you cannot get a grey colour using just those two blocks - you have to use the colour-picker block.)
The hue in Scratch goes round a cycle from zero to 200 as follows:
red (zero) -> yellow (33) -> green (67) -> cyan (100) -> blue (133) -> magenta (167) -> back to red (200 = 0).
If you want to understand more about how the HSL colour-space works, see this wikipedia page: https://en.wikipedia.org/wiki/HSL_and_HSV (you'll see that, traditionally, the hue is given as angle from zero to 360 degrees, so the way that Scratch makes it go from zero to 200 is rather at odds with that…

You might also find this project useful: https://scratch.mit.edu/projects/62752782/
Hope that helps!
Last edited by TheLogFather (July 29, 2015 20:36:34)
- teresabeckham
-
2 posts
Pen colors?
Thank you so much, that does help! I will begin exploring the information you have given me above…..thanks again!
- streamline1
-
79 posts
Pen colors?
Wow, OK. I had no idea.If you use the correct “set pen color” block then, yes, it does - even including alpha transparency. Correct me if I'm wrong, but I don't think that Scratch accepts hexadecimal or RGB colors.
This post will hopefully help explain it: https://scratch.mit.edu/discuss/post/1008848/
Thanks!
-Streamline1
- Sigton
-
1000+ posts
Pen colors?
I see you were mentioning transparency; how do you make the pen transparent? I would really like to know but I haven't been able to find much info on it.If you use the correct “set pen color” block then, yes, it does - even including alpha transparency. Correct me if I'm wrong, but I don't think that Scratch accepts hexadecimal or RGB colors.
This post will hopefully help explain it: https://scratch.mit.edu/discuss/post/1008848/
Sigton
- Creator1972
-
26 posts
Pen colors?
Another way to set the pen color is by clicking the pink square in this block….
…then click on the color of something within the tab to change it.
Hope I helped!
Creator1972
set pen color to [#ff0088]
…then click on the color of something within the tab to change it.
Hope I helped!
Creator1972
- Discussion Forums
- » Help with Scripts
-
» Pen colors?