Page 1 of 1
Fillcolor of a widget
Posted: 19 Nov 2015 02:56
by Mar
Hi,
I'm trying to set a flow which shows a clickable widget. I would like to have an animation instead of the normal immediate appearance. Therfore I have to get the color of widget's elements.
I'm trying to use the function
getWidgetElementProperty
It doesn't work how I have imagined it. It gives back -16777216 for #ff000000.
What does that mean? Why doesn't it give back #ff000000?
Thanks in advance.
Re: Fillcolor of a widget
Posted: 19 Nov 2015 07:46
by kintrupf
Mar wrote:It gives back -16777216 for #ff000000.
What does that mean? Why doesn't it give back #ff000000?
Well, actually the function does return #FF000000

-16777216 is the decimal representation of the number, while #FF000000 is the hexadecimal notation.
Re: Fillcolor of a widget
Posted: 19 Nov 2015 10:10
by Mar
How are these numbers assembled. I understand how it works with the Hexadecimal colors and the values of the ARGB colors also in the decimal system. So how can I convert this decimal color into a Hexadecimal color and how is it assembled? Is that also working with (semi) transparent colors?
Re: Fillcolor of a widget
Posted: 20 Nov 2015 20:19
by Martin
Hi,
Automagic uses 32 bit integer values for colors. You can try this link to convert the decimal value to the hex representation:
https://www.mathsisfun.com/binary-decim ... erter.html
Switch the dropdown to 'signed 32-bit' and enter -16777216 into the decimal field.
Regards,
Martin
Re: Fillcolor of a widget
Posted: 22 Nov 2015 00:18
by Mar
Yes, it works. I've already written a script which convert decimal numbers to hexadecimal numbers. Now I use getAlpha, getRed, getGreen and getBlue to fish out the values.
My aim is to fade in a clickable overlay with an animation.
My problem is now that the function setWidgetElementProperty or probably rather refreshWidget don't work very fast. It takes some minutes. That's a bit to long for an animation
Is there a better way to do this?
Edit:
Maybe a variable support in "Eigenes Widget Overlay anzeigen" for opacity could be the solution. Or you could add there a setting for a smooth animation.
Regards
Re: Fillcolor of a widget
Posted: 22 Nov 2015 19:10
by Martin
Modifying a widget property to play a smooth animation won't work since widgets were mostly meant to be used as home screen widgets.
Adding variable support to the opacity setting in action Show Custom Widget Overlay could work, maybe I could also add some kind of setting to select a few predefined animations. I add it to the todo-list to check if this is feasible.
Regards,
Martin
Re: Fillcolor of a widget
Posted: 23 Nov 2015 15:29
by Mar
Thanks a lot.