Changing dynamically a text color in a widget

Post your questions and help other users.

Moderator: Martin

Post Reply
User avatar
husky
Posts: 132
Joined: 29 Oct 2016 13:41
Location: Omaha, Nebraska, USA
Contact:

Changing dynamically a text color in a widget

Post by husky » 23 Apr 2017 01:00

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
"Basic research is what I'm doing when I don't know what I'm doing"

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

Re: Changing dynamically a text color in a widget

Post by Martin » 23 Apr 2017 18:40

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

User avatar
husky
Posts: 132
Joined: 29 Oct 2016 13:41
Location: Omaha, Nebraska, USA
Contact:

Re: Changing dynamically a text color in a widget

Post by husky » 25 Apr 2017 23:48

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
"Basic research is what I'm doing when I don't know what I'm doing"

Post Reply