Set text transparency in App Inventor

When looking at a label element, at first it doest look like there is any way to set the text transparency, looking at the "make color" block it looks like the block only accepts RGB and so the first thought are okay maybe it doesn't use RGBA.

However, upon further investigation, you will notice that the description of the "split color" block mentions that it returns a list of four elements and mentions alpha as being the fourth element, so how do you change this fourth element?

Well it seems this is a bit of a hidden feature in App Inventor, as you can see the colour blocks are using RGBA under the hood, and the way the set the alpha is simply by adding an additional element to the list that is passed into the "make color" block.

The alpha element is a number from 0 to 255 and you could easily use a clock element to fade text in and out using this method.

As you can see in the following example, the "make color" block is being used with the values from the "split color" block and the alpha value is being incremented by one.

Icons made by DinosoftLabs from is licensed by CC 3.0 BY

Was this helpful?

Yes No


Thunkable Components