ok, so in scratch, the set pen color to block doesn't use rgba, like snap, instead it uses hex or decimal. you can do #ffffff for white (or 0xffffff), or you can do a color decimal. I'm talking about the set pen color to block that has a color picker. In snap, that's different. If you use snapinater to convert a set pen color to block that has something in the input like it'll be in snap. There's just one issue, if I try to run the block, it throws the error, "TypeError: aColor.copy is not a function." I have tried blocks in the Crayons, fair hues, color done right library, but the blocks don't work. I want a block that can set the pen color to decimal or hex from the input so scratch projects won't break in snap.
Have you tried the Set RGB or HSV pen color library?
Never mind; the RGB/HSV library is a subset of the C/FH/CDR library.
yeah, and I want to be able to use decimal/hexadecimal colors using a string like in scratch. I do know how to convert rgb to decimal Computer Colors - Scratch Wiki so it should be possible to convert decimal to rgb. I'll try to figure it out sometime.
Set red to (floor of (colour / 65536)) mod 256
Set green to (floor of (colour / 256)) mod 256
Set blue to (floor of colour) mod 256
Set alpha to (floor of (colour / 16777216)) mod 256
If alpha is 0
, set alpha to 255
is that for decimal or hex?
Its for numbers.
tried it and didn't work.
Yay!!! Someone besides me who knows the difference between a number and a numeral! :~D
The alpha goes from 100-0 instead of 0-255, so you have to fix it.
If hex input will do, take the SET PEN block from the Colors library and choose (3D color spaces) > RGB > RGB hex.
thanks, I didn't see that before. Is there a way to set pen color using decimal?
I know the difference, the numeral 1 is bigger than the numeral 5, but the number 1 is smaller than the number 5.
:~) But you call Scratch numbers "decimal" when really that's just the numerals they use. It matters because if you want to convert a number to hex, for example, you do arithmetic on the number (such as dividing it by sixteen), not character mangling.
scratch can use decimal color codes like this I'm not talking about the set pen [color v] to (1) block
Turns out to be a very dark blue. HEXCHAR is in the Colors library.
P.S. Note how it does arithmetic on NUM but does text operations (JOIN and UNICODE) on the output, which is a numeral. ;~)
thanks, I'll try it out tomorrow
ok, now that I've tried it out, it works. Thanks. I'll make a block that can set the pen color to hex or decimal.