Is it possible to convert R,G,B values into a Hex color within Tasker?

527 views
Skip to first unread message

Nixx

unread,
Sep 2, 2012, 3:03:49 PM9/2/12
to tas...@googlegroups.com
As the title says, is this possible to achieve with taskers math capabilities?
Any one does this before? Or does this need to be done via javascriptlets ?

Matt R

unread,
Sep 2, 2012, 4:00:36 PM9/2/12
to tas...@googlegroups.com
You can use Variable -> Variable Convert to change each value from decimal to hex, then combine the RGB values in hex one after the other to get the entire hex color.

Matt

Nixx

unread,
Sep 2, 2012, 8:15:31 PM9/2/12
to tas...@googlegroups.com
On Sunday, September 2, 2012 10:00:37 PM UTC+2, Matt R wrote:
You can use Variable -> Variable Convert to change each value from decimal to hex, then combine the RGB values in hex one after the other to get the entire hex color.

Matt

aah nice! missed that one

I'm guessing there is no automatic way to let it read "0" as "00" (as it needs two digits to create a valid hexcode)
So not to have to add a extra action that will check if the value is 2 digits or not. (will have 36 of these to check :) )

Matt R

unread,
Sep 3, 2012, 12:28:20 AM9/3/12
to tas...@googlegroups.com
How about doing something like:

Variable Set %Color to %Red * 256^2 + %Green * 256 + %Blue (with do math checked), then convert %Color to hex so you only have to check if a zero needs to be added once. I suppose you could even add an additional + 256^3 so you'd always have a 1 in the 7th digit place and then use Variable Section to only take the last 6 numbers (places 1-6).

Matt

Nixx

unread,
Sep 3, 2012, 7:43:20 PM9/3/12
to tas...@googlegroups.com
Aah, okay, I should have a look at how the hex conversion actually works as I have a limit knowledge on this topic and see what you're doing, but not quite follow it yet :)
thanks.

It would be cool if tasker would have a color picker included. would save (me) allot of hassle.
Currently my app has 16 colors (fixed buttons) but want to upgrade to 125 shades of color...
But have yet to figure out how to optimize this.

to be continued..

Reply all
Reply to author
Forward
0 new messages