Color Extension

This is an App Inventor Extension to convert color models.It has 3 method,more details below.

 

 

AI2HEX

1540888959333

Input an App Inventor color block(either default color block or makecolorblock),and it will return a Hex value.

Example:Input a red block,then it will return feffff.

It is a six-digits hex string,without 0x00 or # in the front,all letters are lower case letters,pay attention to the digit,it has only 6 digits,not 8 or 3.

Usually when you use a hex color value(usually by the web client),you may need to add an # in the front.

 

HEX2AI

1540889953732

Input a Hex color value.It must be a six-digits hex string,without 0x00 or # in the front,all letters must be lower case letters,pay attention to the digit,it has only 6 digits,not 8 or 3.

Then it will return a negative integer,you can just place it after some blocks like set Button1.BackgroundColor to .Actually,App Inventor color value is just a negative number,more details here"App Inventor Color Chart".

 

RGB2HEX

1540890471993

Input r(red),g(green),b(blue) value(integers between 0 and 255),it will return an six-digits hex string,without # in the front.All letters are capital letter.See the example below:

Example:Input rgb value(255,246,123),return FFF67B.

Its result is different from the hex value of the first method or the second one.So pay attention to this point.Remember the capital letter.

 

Example Program

1540890893945


Download aix file here

 

原文