Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Setting token_tint from a query

1681329065
CryptoCartographer
Pro
Marketplace Creator
I'm trying to make a query that allows the user to select from a list of colors to tint a token. The "transparent" works well enough to remove the tint, but none of the rgb values will assign as I'd hoped. I'm guessing that the hash is confusing the "tint_color" option, but a pipe doesn't work either. Is there a syntax for this that will save me from having to maintain a separate macro for every single color choice? !token-mod {{   --set     ?{Color|None,tint_color#transparent       |Red,tint_color#rgb(256,0,0)       |Orange,tint_color#rgb(256,127,0)       |Yellow,tint_color#rgb(256,228,0)       |Green,tint_color#rgb(000,256,0)       |Cyan,tint_color#rgb(000,240,256)       |Teal,tint_color#rgb(0,180,148)       |Blue,tint_color#rgb(0,0,256)       |Purple,tint_color#rgb(140,0,256)       |Pink,tint_color#rgb(222,118,222) } }}
1681339081

Edited 1681339281
The issue is the commas in the rgb value are breaking the query.  I don't think TokenMod currently includes a comma replacement character (how # is a replacement for |) but I could be wrong. You'll probably be able to use ZeroFrame to dynamically include a replacement character for the comma. See this post by Timmaugh for more info .
Awhile back I wrote a Mod to randomly assign tint colors to tokens in a selected group (RandomTokenTinter in the Roll20 library).
1681353999

Edited 1681355624
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Hi CryptoCartographer! Token-mod wi ll convert color value systems on the fly, from #ff0000 to #rgb(256,0,0) for instance. I'd suggest just using hex and abandoning rgb.
1681389408
CryptoCartographer
Pro
Marketplace Creator
@Jarren @Bill @keithcurtis Thanks for the tips! For posterity, Here's what ultimately worked: !token-mod {{   --set     ?{Color|None,tint_color#transparent       |Red,tint_color#ff0000       |Orange,tint_color#ff8000       |Yellow,tint_color#ffe400       |Green,tint_color#00ff00       |Cyan,tint_color#00f0ff       |Teal,tint_color#00b4a6       |Blue,tint_color#0000ff       |Purple,tint_color#9000ff       |Pink,tint_color#de62de } }}
1681399115

Edited 1681399313
The Aaron
Roll20 Production Team
API Scripter
Sorry for the late reply, I'll see about adding an alternate from for the commas in rgb and hsv. BTW, if you're only setting the color_tint, you could extract it out of the query, just to make it less busy: !token-mod {{ --set tint_color|?{Color|None,transparent |Red,ff0000 |Orange,ff8000 |Yellow,ffe400 |Green,00ff00 |Cyan,00f0ff |Teal,00b4a6 |Blue,0000ff |Purple,9000ff |Pink,de62de } }}
1681570006
CryptoCartographer
Pro
Marketplace Creator
Thanks! This tidied things up quite a bit. The Aaron said: Sorry for the late reply, I'll see about adding an alternate from for the commas in rgb and hsv. BTW, if you're only setting the color_tint, you could extract it out of the query, just to make it less busy: !token-mod {{ --set tint_color|?{Color|None,transparent |Red,ff0000 |Orange,ff8000 |Yellow,ffe400 |Green,00ff00 |Cyan,00f0ff |Teal,00b4a6 |Blue,0000ff |Purple,9000ff |Pink,de62de } }}