Page 1 of 1

Changing dynamically a text color in a widget

Posted: 23 Apr 2017 01:00
by husky
Hello,

Having a "widget" (AutoMagic shortcut) that shows for example phone temperature (Text_1) my question is:

Is there a way to change programatically the color of the temperature text, from white (OK) to yellow (getting hot) and red (way too hot)?

I had contemplated the idea of three different texts in the "widget", one for each situation but my goal would be to change always the same "Text_1" instead of using three "Text_1, 2 and 3".


Thank You


Husky

Re: Changing dynamically a text color in a widget

Posted: 23 Apr 2017 18:40
by Martin
Hi,

You can use an action Script with function setWidgetElementProperty to modify almost all properties of a widget element, including the fillcolor and the outlinecolor of a text element.
Scroll down to the tips section of this tutorial for a brief introduction: Creating a Custom Widget.

Regards,
Martin

Re: Changing dynamically a text color in a widget

Posted: 25 Apr 2017 23:48
by husky
Hello Martin,

Sorry for the late reply.

Thank You for the great reply of yours. Things are getting easier as I have the hints from you.

Already made some simple widgets, changing background color and text color.


Regards


Husky