Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » RGB Color Converter?
- gtar1
-
Scratcher
100+ posts
RGB Color Converter?
I need to get an all black pen color and I was wondering if it would work if I could use RGB values. Or you could just show me how to get a plain black pen color.
Thanks!
Thanks!- asivi
-
Scratcher
1000+ posts
RGB Color Converter?
set pen color to [#e4b24e]//get this block
set pen color to (join [] [0])//and do this
- gtar1
-
Scratcher
100+ posts
RGB Color Converter?
cool! thanks!set pen color to [#e4b24e]//get this block
set pen color to (join [] [0])//and do this
- gtar1
-
Scratcher
100+ posts
RGB Color Converter?
Hey! Using your help, I made a pen logo! I haven't shared it, but you can check it out on phosphorus: https://phosphorus.github.io/#140520107set pen color to [#e4b24e]//get this block
set pen color to (join [] [0])//and do this
- Extremguy
-
Scratcher
100+ posts
RGB Color Converter?
R = Red
G = Green
B = Blue
Color = (R * 65536) + (G * 255) + B
R , G and B should be from 0 to 255 inclusively.
The RGB for Black is (0,0,0) or just 0 if we do the formula up here.
https://wiki.scratch.mit.edu/wiki/Computer_Colors
G = Green
B = Blue
Color = (R * 65536) + (G * 255) + B
R , G and B should be from 0 to 255 inclusively.
The RGB for Black is (0,0,0) or just 0 if we do the formula up here.
https://wiki.scratch.mit.edu/wiki/Computer_Colors
- stickfiregames
-
Scratcher
1000+ posts
RGB Color Converter?
For RGB colours in general you have to do this for decimal RGB values (0-255):cool! thanks!set pen color to [#e4b24e]//get this block
set pen color to (join [] [0])//and do this
set pen color to (((r :: #ff0000) * (65536)) + (((g :: #00ff00) * (256)) + (b :: #0000ff)))or this for hex codes:
set pen color to (join [0x] [000000]) // 0x makes Scratch interpret the string as a hex number
Last edited by stickfiregames (Jan. 22, 2017 12:56:42)
- ad1406
-
Scratcher
63 posts
RGB Color Converter?
set pen color to ((0) / (0))
To get a black color.
Last edited by ad1406 (Jan. 22, 2017 13:08:43)
- TheLogFather
-
Scratcher
1000+ posts
RGB Color Converter?
R = RedJust to note that the value multiplying the G should be 256, not 255.
G = Green
B = Blue
Color = (R * 65536) + (G * 255) + B
R , G and B should be from 0 to 255 inclusively.
You also should ensure R and G are integers (otherwise it'll ‘bleed’ into the lower components when multiplied by 65536 and 256)…
[Doesn't matter about B being an integer, since it can't bleed into anything lower. It'll only take the integer part of B anyway.]
Also, you can make the pen semi-transparent by setting the alpha component:
A*16777216 + R*65536 + G*256 + B
The alpha value, A, should also be an integer from zero to 255. A value of 255 means fully opaque while a value of one means pretty much totally transparent. Note that an alpha value of zero is considered to be fully opaque, in order to make everything backward compatible with earlier versions of Scratch that did not recognise the alpha component.
Last edited by TheLogFather (Jan. 22, 2017 16:23:17)
- ThunderBolt-
-
Scratcher
16 posts
RGB Color Converter?
if i want to color something on pen from a rainbow pallete and move the sprit of tthe pen to a random place how do i get the color it is on without a million touching colorblocks?
- Tronche2Cake
-
Scratcher
100+ posts
RGB Color Converter?
You could use the pen's brightness value and set it to the minimum
- Invalid_text
-
Scratcher
100+ posts
RGB Color Converter?
What about costumes? How do you change the color of a costume using hex code?
- Discussion Forums
- » Help with Scripts
-
» RGB Color Converter?