2016년 11월 17일 목요일

Color codes generated by GetPixelColor Canvas' Method, what's the deal?


So... I'm trying to create a color recognition software and I got stuck at this color codes AppInventor generates when using the GetPixelColor Canvas' method.

Searching a little, I've found a Color Chart which contains a variety of colors and their respective codes, but (obviously) not all colors are listed there, and even after staring at those codes for a while, I still could not find a pattern with known color codes. It doesn't look like RGB nor CMY, and what's with the minus before the codes? I'd really appreciate If someone could enlighten me about this feature.

Thanks for the help in advance,
Pantaleão.

-- 
see the documentation http://appinventor.mit.edu/explore/ai2/support/blocks/colors.html
and use the make color block to create a color

make color

 make color takes in a list of 3 or 4 numbers. These numbers in this list represent values in an RGB code. RGB codes are used to make colors on the Internet. An RGB color chart is available here. This first number in this list represents the R value of the code. The second represents the G. The third represents the B. The fourth value is optional and represents the alpha value or how saturated the color is. The default alpha value is 100. Experiment with different values and see how the colors change using this block.
see also the split color block
Taifun

split color


split color does the opposite of make color. It takes in a color: a color block, variable holding a color, or property from one of the components representing a color and returns a list of the RGB values in that color's RGB code.




-- 
Soooooo... yeah, thanks Taifun, the split color block made it's trick.
Just out of curiosity, would you know how AppInventor creates that bizarre number in which it represents its colors? (The numbers like in the color chart)
I just get no meaning out of it.

Anyway, thanks for the help again!



--
I don't know more about the details, but see again the documentation

How do colors work in App Inventor?

Internally, App Inventor stores each color as a single number. When you use make color and take in a list as an argument,internally this list is then converted using App Inventor's color scheme and stored as a number. If you knew the numbers for the colors, you could even specify what color you wanted something to be by just setting its Color property to a specific number. If you want to see a chart of colors to numbers, check out this page.

if you like to know more, feel free to take a look at the MIT App Inventorsources

Taifun


-- 
Hi, some information in this post...

댓글 없음:

댓글 쓰기