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

Making inline roll results transparent

I have a particular roll template generated by an API and submitted by sendchat() in which I want the inline roll results to be black text on a transparent background instead of the normal yellow (or purple in dark mode).  Is there a simple way to override the .inlinerollresult CSS class from within the Javascript just for this one roll template call?
1652960603
timmaugh
Pro
API Scripter
Oosh found a way to hide HTML in the roll template call a while back. I think it's in the Stupid Tricks  ... Fantastic Tricks and Where to Find Them Greatest Trick (and 21 Other Pretty Cool Tricks) My Trick is Better than Bacon ...that thread. Whatever it's called now. I'll see if I can find it or ping Oosh LaBeoush to take a look.
1652963447

Edited 1652963693
Oosh
Sheet Author
API Scripter
My brain isn't remembering any trick that could override an inline roll made in the sendChat itself.... You can use libInline (or your own code) to reconstruct the roll and throw your own inline style in there, which will net the same result as  the original roll but with the caveat of having the "API-generated content" in the tooltip, and no quantum roll logo (as per the libInline thread notes). That would just mean either using the sendChat callback, or promisifying and awaiting the inital roll. The only other thing I can think of, is if it's your own character sheet and you can add some CSS rules, you can conditionally override the CSS by wrapping in your own class of div: sendChat('', `&{template:myTemplate} {{roll=<div class="customroll">[[1d20]]</div>`); and .userscript-customroll .inlinerollresult { background:none!important ; } The chat parser will prefix your inline class names with 'userscript', and you probably need to use the forbidden naughtiness of !important, but hey, Roll20's stylesheets are full of !importants, and I say fight fire with fire ! Nope, you don't even need !important. The base CSS has a shallow selector. If I did genuinely invent a trick to force inline styles into a live inline roll, it's disappeared in a puff of ethanol. Or maybe Tim is giving me credit for someone else's cleverness, and there's nothing at all wrong with my memory!
1652965339
timmaugh
Pro
API Scripter
Two things can be right at the same time... ...I can totally be giving Oosh credit for something he didn't do, and ...there's absolutely everything wrong with Oosh, including his memory. =D But, like Oosh mentioned, you can use libInline to get the rollTip from your roll, then parse and replace certain parts of it to remove class names or introduce selector-level CSS. I should probably build a way into the library to let you do custom formatting... feeding css rules into the various levels of the roll output. I'll have to think about that, maybe get some input from the HoM crew on the best way to implement it... *mutters off... lost in thought*
Thanks all.  I'm finding out new things every day... I'll take a gander at libInline to see if I can MacGyver something!