Page 1 of 1

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

PostPosted: Wed Apr 14, 2021 6:37 am
by Yakpimp
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!

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

PostPosted: Thu Apr 15, 2021 8:41 pm
by TheLaGmAn
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

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

PostPosted: Fri Apr 16, 2021 4:34 pm
by Yakpimp
# 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?

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

PostPosted: Fri Apr 16, 2021 4:35 pm
by Yakpimp
Nevermind, I missed a checkbox on the middle field :)