Looking for a mathematical genius! (converting HEX to HSV)

420

Active member
I had the wild idea to use the UItask plugin "color dialog" action to change the color of my smart rgb bulbs, but the service i use to control the bulbs works with HSV.
So i am looking for a way to convert the HEX color codes, that are output by the UItask plugin, to HSV color codes using macrodroid.

I found plenty of websites that can do this, but i have no idea how they are doing it, so i hope someone can help me with this, It would be pretty sick if i could make this work!


Ps: i really only need the h(ue) value, the other two don't matter to me.
 

420

Active member
I had the wild idea to use the UItask plugin "color dialog" action to change the color of my smart rgb bulbs, but the service i use to control the bulbs works with HSV.
So i am looking for a way to convert the HEX color codes, that are output by the UItask plugin, to HSV color codes using macrodroid.

I found plenty of websites that can do this, but i have no idea how they are doing it, so i hope someone can help me with this, It would be pretty sick if i could make this work!


Ps: i really only need the h(ue) value, the other two don't matter to me.
I found a formula, but i am to stupid to understand it ☹️

RGB to HSV conversion formula​

The R,G,B values are divided by 255 to change the range from 0..255 to 0..1:

R' = R/255

G' = G/255

B' = B/255

Cmax = max(R', G', B')

Cmin = min(R', G', B')

Δ = Cmax - Cmin



Hue calculation:

hue-calc2.gif




Saturation calculation:

sat-calc.gif




Value calculation:

V = Cmax
 

420

Active member
Just to update;

I have given up on this idea, i've gotten pretty far and it works for some HEX codes but not for all... (making it pretty much unusable)

I probably made a mistake somewhere, but it's gotten way over my head... I am just going to use a list dialog to choose a colour instead.
 

420

Active member
Incase anyone is interested, this is what i've created, it took 3 screenshots to fit it all :ROFLMAO:


1.png
2.png
3.png
 

maryrick

New member
I am almost completely sure that in such a case you should turn to professionals. Only they will be able to be responsible for how they do their job. And they will almost certainly do it faster. What kind of light bulbs do you use and where did you order them? Personally, I purchased my own using the platform https://www.vont.com/product/vont-bulb-color-smart-light-bulbs-smart-bulbs /, I have no complaints about them. A perfectly working remote control cannot but please me. So I'm pretty sure it's a great purchase.
 
Last edited:
Top