Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » Scratch color parameter saving format?
- GP1
- Scratcher
100+ posts
Scratch color parameter saving format?
Hello. I opened up the JSON of a project with the
The value that Scratch saves to the JSON is -13687519 for the color. Looking around, it looks like this is a 8-bit color format? Perhaps RRRGGGBB? If so, why is there a negative, unless it is unsigned (or signed, what ever it is, I can't remember).
<touching color [#000000]?>block. The block's object looked like this:
["touchingColor:", -13687519]
- scimonster
- Scratcher
1000+ posts
Scratch color parameter saving format?
apparently.I agree with the statement, but where does it say that on the wiki article? ~~~~ Hexadecimal 0xAARRGGBB,
Have a look at this project,: I believe it's the same idea.
Retired Community Moderator
BTW, i run Google Chrome 41.0.2272.101 on a Linux system - Ubuntu 14.04. NEW: iPad 4th gen. w/retina.
418 I'm a teapot (original - to be read by bored computer geeks)
THE GAME (you just lost)
; THE SEMICOLON LIVES ON IN OUR SIGS
- blob8108
- Scratcher
1000+ posts
Scratch color parameter saving format?
In a couple of places, describing color-related fields. For example, the `textColor` field on where does it say that on the wiki article?Scratch_2.0_File_Format#Costume_objects.
~~~~
- MathWizz
- Scratcher
100+ posts
Scratch color parameter saving format?
To add to blob, it is also signed.
running Chromium 42.0.2311.90 with Flash Player 15.0.0.189 on Arch Linux 3.19.5-1-ck
MathWizz — JsScratch && sb.js & Amber (coming soon! maybe)
- davidkt
- Scratcher
1000+ posts
Scratch color parameter saving format?
What's the A?
Remember when I looked like this? I still do.
Float, my Scratch 2.0 mod | My (somewhat under-construction) blog
Float, my Scratch 2.0 mod | My (somewhat under-construction) blog
- GP1
- Scratcher
100+ posts
Scratch color parameter saving format?
Ok, cool. I made some JavaScript on a JSFiddle to see if I could do it from the value to ARGB. Here is the code I got. I don't know whether I am supposed to keep the value in the project signed or not.
var colorNumber = -13687519;
var a = colorNumber >> 24 & 0xFF;
var r = colorNumber >> 16 & 0xFF;
var g = colorNumber >> 8 & 0xFF;
var b = colorNumber & 0xFF;
window.alert("a: " + a + "\nr: " + r + "\ng: " + g + "\nb: " + b);
Last edited by GP1 (April 16, 2014 22:57:30)
- Discussion Forums
- » Advanced Topics
- » Scratch color parameter saving format?