Fillcolor of a widget

Post your questions and help other users.

Moderator: Martin

Post Reply
Mar
Posts: 49
Joined: 20 May 2015 23:24
Location: Germany

Fillcolor of a widget

Post by Mar » 19 Nov 2015 02:56

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.

User avatar
kintrupf
Posts: 257
Joined: 10 Sep 2013 08:59

Re: Fillcolor of a widget

Post by kintrupf » 19 Nov 2015 07:46

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.

Mar
Posts: 49
Joined: 20 May 2015 23:24
Location: Germany

Re: Fillcolor of a widget

Post by Mar » 19 Nov 2015 10:10

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?

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Fillcolor of a widget

Post by Martin » 20 Nov 2015 20:19

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

Mar
Posts: 49
Joined: 20 May 2015 23:24
Location: Germany

Re: Fillcolor of a widget

Post by Mar » 22 Nov 2015 00:18

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

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Fillcolor of a widget

Post by Martin » 22 Nov 2015 19:10

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

Mar
Posts: 49
Joined: 20 May 2015 23:24
Location: Germany

Re: Fillcolor of a widget

Post by Mar » 23 Nov 2015 15:29

Thanks a lot.

Post Reply