Pass the color from the field to the title/caption

64 views
Skip to first unread message

Mike Andyl

unread,
Jul 10, 2021, 10:30:22 AM7/10/21
to TiddlyWiki
I can create a field with color.
And caption
@@color:{{!!color}}; {{!!title}} @@

The name is transmitted correctly, but the color is ignored. How to do it right?

In HTML:
<span class="tc-inline-style" style="color:{{!!color}};"> New Tiddler 121231 </span>

Eric Shulman

unread,
Jul 10, 2021, 11:22:55 AM7/10/21
to TiddlyWiki
1) You can't use a field reference as part of the inline style syntax
2) You can't use a field reference as part of an HTML style attribute value

To achieve the results you want, you can construct the entire style attribute value using filtered transclusion, like this:
<span style={{{ [[color:]addsuffix{!!color}] }}}> {{!!title}} </span>

enjoy,
-e

Mike Andyl

unread,
Jul 10, 2021, 6:29:31 PM7/10/21
to TiddlyWiki
Wow! Already three brackets have been used!
Thank you.

суббота, 10 июля 2021 г. в 18:22:55 UTC+3, Eric Shulman:
Reply all
Reply to author
Forward
0 new messages