2014-12-06 13:44:08 +00:00
|
|
|
title: $:/core/macros/tag
|
|
|
|
tags: $:/tags/Macro
|
|
|
|
|
2016-11-28 19:17:25 +00:00
|
|
|
\define tag-pill-styles()
|
|
|
|
background-color:$(backgroundColor)$;
|
|
|
|
fill:$(foregroundColor)$;
|
|
|
|
color:$(foregroundColor)$;
|
|
|
|
\end
|
|
|
|
|
2022-04-16 16:19:05 +00:00
|
|
|
<!-- This has no whitespace trim to avoid modifying $actions$. Closing tags omitted for brevity. -->
|
2016-11-28 19:17:25 +00:00
|
|
|
\define tag-pill-inner(tag,icon,colour,fallbackTarget,colourA,colourB,element-tag,element-attributes,actions)
|
2023-06-24 13:52:43 +00:00
|
|
|
\whitespace trim
|
2023-08-25 13:06:17 +00:00
|
|
|
<$let
|
2022-04-16 16:19:05 +00:00
|
|
|
foregroundColor=<<contrastcolour target:"""$colour$""" fallbackTarget:"""$fallbackTarget$""" colourA:"""$colourA$""" colourB:"""$colourB$""">>
|
2023-06-24 13:52:43 +00:00
|
|
|
backgroundColor=<<__colour__>>
|
|
|
|
>
|
|
|
|
<$element-tag$
|
2022-04-16 16:19:05 +00:00
|
|
|
$element-attributes$
|
|
|
|
class="tc-tag-label tc-btn-invisible"
|
|
|
|
style=<<tag-pill-styles>>
|
2023-06-24 13:52:43 +00:00
|
|
|
>
|
|
|
|
<<__actions__>>
|
|
|
|
<$transclude tiddler=<<__icon__>>/>
|
|
|
|
<$view tiddler=<<__tag__>> field="title" format="text" />
|
|
|
|
</$element-tag$>
|
2023-08-25 13:06:17 +00:00
|
|
|
</$let>
|
2016-11-28 19:17:25 +00:00
|
|
|
\end
|
|
|
|
|
|
|
|
\define tag-pill-body(tag,icon,colour,palette,element-tag,element-attributes,actions)
|
2023-06-24 13:52:43 +00:00
|
|
|
\whitespace trim
|
|
|
|
<$macrocall $name="tag-pill-inner"
|
|
|
|
tag=<<__tag__>>
|
|
|
|
icon=<<__icon__>>
|
|
|
|
colour=<<__colour__>>
|
|
|
|
fallbackTarget={{$palette$##tag-background}}
|
|
|
|
colourA={{$palette$##foreground}}
|
|
|
|
colourB={{$palette$##background}}
|
|
|
|
element-tag=<<__element-tag__>>
|
|
|
|
element-attributes=<<__element-attributes__>>
|
|
|
|
actions=<<__actions__>>
|
|
|
|
/>
|
2016-11-28 19:17:25 +00:00
|
|
|
\end
|
|
|
|
|
|
|
|
\define tag-pill(tag,element-tag:"span",element-attributes:"",actions:"")
|
2022-04-16 16:19:05 +00:00
|
|
|
\whitespace trim
|
2021-03-13 13:19:12 +00:00
|
|
|
<span class="tc-tag-list-item" data-tag-title=<<__tag__>>>
|
2023-06-24 13:52:43 +00:00
|
|
|
<$let currentTiddler=<<__tag__>>>
|
|
|
|
<$macrocall $name="tag-pill-body"
|
|
|
|
tag=<<__tag__>>
|
|
|
|
icon={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/TiddlerIconFilter]!is[draft]get[text]] }}}
|
|
|
|
colour={{{ [<currentTiddler>] :cascade[all[shadows+tiddlers]tag[$:/tags/TiddlerColourFilter]!is[draft]get[text]] }}}
|
|
|
|
palette={{$:/palette}}
|
|
|
|
element-tag=<<__element-tag__>>
|
|
|
|
element-attributes=<<__element-attributes__>>
|
|
|
|
actions=<<__actions__>>/>
|
|
|
|
</$let>
|
2016-11-28 19:17:25 +00:00
|
|
|
</span>
|
|
|
|
\end
|
|
|
|
|
2014-12-06 13:44:08 +00:00
|
|
|
\define tag(tag)
|
2016-12-16 17:25:03 +00:00
|
|
|
{{$tag$||$:/core/ui/TagTemplate}}
|
2014-12-06 13:44:08 +00:00
|
|
|
\end
|