Is there a way to change the color of output dynamically?

Questions regarding plugin development and publish plugins

Is there a way to change the color of output dynamically?

Postby Yakpimp » Wed Apr 14, 2021 6:37 am

I've been working on a plugin to display some bitcoin/ethereum price data as well as monitor my mining machines.

I specifically want to change the color of the text drawn that shows the temperature based on the actual value. I thought the way to do this would be using SensorHasCustomDraw but I only see that get called when in the profile editor. How can I change the color of a sensor at runtime based on some data?

Do I need to carry a color variable around and set that on my update and then in my custom draw, draw that item using the custom color?

Thanks in advance!

Yakpimp
 
Posts: 6
Joined: Thu Mar 11, 2021 8:11 pm

Re: Is there a way to change the color of output dynamically

Postby TheLaGmAn » Thu Apr 15, 2021 8:41 pm

You have two options here.
1- Doing it from the plugin side, you have to draw the element yourself and not just collect the sensor info, because in this scenario, you are only providing sensors to GOverlay and is up to the user to pick a color.
2- Leave the color change to the user. The user can set a dynamic color by using the VisualScript feature (to use it, next to the sensor you picked on a text element you have the VS icon to open it, then set if value > X, set property color to Y, otherwise Z
User avatar
TheLaGmAn
Site Admin
 
Posts: 967
Joined: Wed Feb 26, 2014 8:32 pm

Re: Is there a way to change the color of output dynamically

Postby Yakpimp » Fri Apr 16, 2021 4:34 pm

# 2 is what I was looking for.

I ended up having to use set the threshold to 0 and the threshold color to what I wanted for it to work.

I noticed an issue though, I saved out the VS and loaded it on my other temperature sensors and it seems to work for some but others it seems to have no effect. I assume I don't have to manually recreate it for each right?

Yakpimp
 
Posts: 6
Joined: Thu Mar 11, 2021 8:11 pm

Re: Is there a way to change the color of output dynamically

Postby Yakpimp » Fri Apr 16, 2021 4:35 pm

Nevermind, I missed a checkbox on the middle field :)

Yakpimp
 
Posts: 6
Joined: Thu Mar 11, 2021 8:11 pm


Return to Plugins Releases and Development



Who is online

Users browsing this forum: Google [Bot] and 6 guests