Discuss Scratch

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!
asivi
Scratcher
1000+ posts

RGB Color Converter?

setpencolortoget this blocksetpencolortojoin0and do this
gtar1
Scratcher
100+ posts

RGB Color Converter?

asivi wrote:

setpencolortoget this blocksetpencolortojoin0and do this
cool! thanks!
gtar1
Scratcher
100+ posts

RGB Color Converter?

asivi wrote:

setpencolortoget this blocksetpencolortojoin0and do this
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/#140520107
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
stickfiregames
Scratcher
1000+ posts

RGB Color Converter?

gtar1 wrote:

asivi wrote:

setpencolortoget this blocksetpencolortojoin0and do this
cool! thanks!
For RGB colours in general you have to do this for decimal RGB values (0-255):
setpencolortor*65536+g*256+b
or this for hex codes:
setpencolortojoin0x000000 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?

setpencolorto0/0

To get a black color.

Last edited by ad1406 (Jan. 22, 2017 13:08:43)

TheLogFather
Scratcher
1000+ posts

RGB Color Converter?

Extremguy wrote:

R = Red
G = Green
B = Blue

Color = (R * 65536) + (G * 255) + B

R , G and B should be from 0 to 255 inclusively.
Just to note that the value multiplying the G should be 256, not 255.

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)

the_paperclip
Scratcher
2 posts

RGB Color Converter?

Thanks, I needed that info.
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
mcgoomba
Scratcher
1000+ posts

RGB Color Converter?

just
setpencolorto
Invalid_text
Scratcher
100+ posts

RGB Color Converter?

What about costumes? How do you change the color of a costume using hex code?

Powered by DjangoBB