- Open https://tiddlywiki.com/prerelease/parameterised-transclusions/
- Create a tiddler tagged with
$:/tags/Macro
with below content
\function cstyle()
[all[current]tag[Task]!tag[Done]then[color:red;]] :else[all[current]tag[Task]tag[Done]then[color:green;]]
\end cstyle
\define msg(str)
<div style=<<cstyle>> >
<<__str__>>
</div>
\end
- Now in another tiddler call
msg
for example
<<msg "Hello Parametrised Transclusion.">>
- tag tiddler with Task, the message is read
- tag tiddler with Task and then Done , the message is green
The function generates the right text color based on tags of current tiddler.
In TW before 5.3.0, you have to do this using filtered transclusion.