Assuming that you never have a color that matches "XXX", this seems to work:
\define colors2(color txtcolor bgcolor) <span style="font-size:1em;color:$color$;">■ <span style="color:<<__txtcolor__>>;background-color:$bgcolor$;border-radius:5px; margin:1em;padding:9px 12px 10px"> $color$</span> </span> \end \define colors(color:"black", txtcolor:"", bgcolor:"XXX") <$vars color=<<__color__>> bgcolorinit=<<__bgcolor__>>> <$list filter="[<color>] [<bgcolorinit>] +[!prefix[XXX]last[1]]" variable= "bgcolor"> <$macrocall $name="colors2" color=<<__color__>> txtcolor=<<__txtcolor__>> bgcolor=<<bgcolor>>/> </$list> </$vars> \end <<colors "blue" "blue" "yellow" >> If WikiText is to be taken as a serious replacement for javascript, it really needs an equality operator. I submitted a PR for this, but it got bogged down by a discussion about naming conventions. I'm sure there's others that have submitted similar. I was very close to working out a solution that might have been a little cleaner, when apparently the new <<__parameter__>> syntax triggered a recursion error. Oh well, maybe someone else will have an insight. -- Mark On Tuesday, July 17, 2018 at 11:16:36 AM UTC-7, talha131 wrote: > > My apologies for lack of clarification. > > I have this macro > > \define colors(color:"black", txtcolor:"", bgcolor:"") > <span style="font-size:1em;color:$color$;">■ > <span style="color:$txtcolor$;background-color:$bgcolor$;border-radius:5px; > margin:1em;padding:9px 12px 10px"> > $color$</span></span> > \end > > What I want to do is, if bgcolor is undefined then use whatever value is > assigned to color variable. > > I searched the forum. Unfortunately I didn’t quite understand the answers > there. > > One more thing, instead of using $txtcolor$, I have tried <<txtcolor>> > and <<__txtcolor__>> but they didn’t work. Am I correct to assume, inside > HTML tags, <<>> syntax does not work? > > -- You received this message because you are subscribed to the Google Groups "TiddlyWiki" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/tiddlywiki. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/b9b75d83-ff0d-49ec-9801-3c0fcbfecdb0%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

