What color formats / encoding are these Flash color values ​​in

I parse the color codes that I get from the Flex application (Flash ActionScript), and then create the HTML div elements with the same color.

My problem: Colors are only 8 digits. So they can't have RGB color values? What color format are they in? If I can determine the format they are in, I can convert them to RGB. Maybe the last / first digit means 0. alpha?

PS: Should I convert colors to RGB or something else?

This is an example of the color code values ​​that I get from a flash application:

16777215 4803910 84545883 16777215 
+4
source share
1 answer

RGB colors are represented by hexadecimal digits (base 16).

Base 16 means that each place in a number can represent numbers 0-15 in the following order:

 0 1 2 3 4 5 6 7 8 9 ABCDEF 

Using 0x in AS3 is a hexadecimal number. As an example, run this:

 trace(0xF); // 15 

The output you see is presented in decimal (base 10). What you see above in your question is a decimal representation of your colors.

If you want to see the hex version, use toString() and parse 16 as a radix parameter. You will notice that the default is 10 (for the base 10 / decimal numbers that we all know and love).

 var num:int = 15; trace(num.toString(16)); // f 

Hope this makes sense.

+5
source

Source: https://habr.com/ru/post/1379053/


All Articles