2014-02-20 10:00:38 +00:00
|
|
|
title: $:/snippets/currpalettepreview
|
|
|
|
|
2020-07-15 13:23:13 +02:00
|
|
|
\whitespace trim
|
2024-10-25 09:28:33 +01:00
|
|
|
|
2024-11-10 09:52:43 +00:00
|
|
|
\procedure colour-div-filtered(class,styleName,styleColour)
|
2025-02-03 13:26:25 +00:00
|
|
|
|
|
|
|
\function colour-inner-get-imported-palette(name,tv-palette-name)
|
|
|
|
[[palette-import@]addsuffix<scheme>] :map[<tv-palette-name>get<currentTiddler>has[title]] +[!match[]] :else[<tv-palette-name>get[palette-import]has[title]] :map[function[colour-inner-get-palette-entry],<name>,<currentTiddler>] +[!match[]]
|
|
|
|
\end colour-inner-get-imported-palette
|
|
|
|
|
|
|
|
\function colour-inner-get-palette-entry(name,tv-palette-name)
|
2025-02-06 11:27:04 +00:00
|
|
|
[<name>addprefix[@]addprefix<scheme>] :map[<tv-palette-name>getindex<currentTiddler>] +[!match[]] :else[<tv-palette-name>getindex<name>] :map[tf.colour-inner-transform-classic-palette-entry<currentTiddler>] :else[function[colour-inner-get-imported-palette],<name>,<tv-palette-name>]
|
2025-02-03 13:26:25 +00:00
|
|
|
\end colour-inner-get-palette-entry
|
|
|
|
|
2024-11-14 17:40:58 +00:00
|
|
|
<!-- Note the join, needed to cope with palette entries containing spaces -->
|
2025-02-03 13:26:25 +00:00
|
|
|
\function colour(name)
|
2025-02-06 11:27:04 +00:00
|
|
|
[function[colour-inner-get-palette-entry],<name>,<tv-palette-name>] :else[[$:/config/DefaultColourMappings/]addsuffix<name>get[text]] :map[subfilter<currentTiddler>join[ ]]
|
2025-02-03 13:26:25 +00:00
|
|
|
\end colour
|
|
|
|
|
|
|
|
\function color(name)
|
|
|
|
[function[colour],<name>]
|
|
|
|
\end color
|
|
|
|
|
2024-11-14 17:40:58 +00:00
|
|
|
<$let
|
2024-11-17 14:45:41 +00:00
|
|
|
colour-result={{{ [function[colour],<styleColour>] }}}
|
2024-11-14 17:40:58 +00:00
|
|
|
>
|
|
|
|
<div class=<<class>> style={{{ [<styleName>addsuffix[:]addsuffix<colour-result>addsuffix[;]] }}}>
|
|
|
|
<$slot $name="ts-raw" $depth="2"/>
|
|
|
|
</div>
|
2024-11-10 09:52:43 +00:00
|
|
|
</$let>
|
|
|
|
\end colour-div-filtered
|
|
|
|
|
|
|
|
\widget $colour.div(class,styleName,styleColour)
|
|
|
|
<%if [<styleName>!match[]] %>
|
2025-02-06 11:27:04 +00:00
|
|
|
<$transclude $variable="colour-div-filtered" class=<<class>> styleName=<<styleName>> styleColour=<<styleColour>>/>
|
2024-11-07 18:30:39 +00:00
|
|
|
<%else%>
|
|
|
|
<div class=<<class>>>
|
|
|
|
<$slot $name="ts-raw"/>
|
|
|
|
</div>
|
|
|
|
<%endif%>
|
|
|
|
\end $colour.div
|
|
|
|
|
2024-11-17 14:45:41 +00:00
|
|
|
\procedure palette-preview-component-list(tag)
|
|
|
|
<$list filter="[all[shadows+tiddlers]tag<tag>!has[draft.of]]" variable="componentTitle">
|
|
|
|
<$transclude $tiddler=<<componentTitle>> title=<<title>>/>
|
|
|
|
</$list>
|
|
|
|
\end palette-preview-component-list
|
|
|
|
|
2024-10-25 09:28:33 +01:00
|
|
|
\procedure palette-preview-thumbnail()
|
2025-02-03 13:26:25 +00:00
|
|
|
<!-- Compute the scheme of the current palette -->
|
|
|
|
<$let
|
|
|
|
tv-palette-name=<<currentTiddler>>
|
|
|
|
color-scheme-filter={{{ [<tv-palette-name>get[color-scheme]] :else[[light]] }}}
|
|
|
|
scheme={{{ [subfilter<color-scheme-filter>] }}}
|
|
|
|
>
|
|
|
|
<!-- Render the thumbnail and its child components -->
|
|
|
|
<$colour.div class="tc-palette-preview-thumbnail" styleName="background-color" styleColour="page-background">
|
|
|
|
<$list filter="[all[shadows+tiddlers]tag[$:/tags/Preview/Page]!has[draft.of]]" variable="componentTitle">
|
|
|
|
<$transclude $tiddler=<<componentTitle>> title=<<title>>/>
|
|
|
|
</$list>
|
|
|
|
</$colour.div>
|
|
|
|
</$let>
|
2024-10-25 09:28:33 +01:00
|
|
|
\end palette-preview-thumbnail
|
|
|
|
|
2025-02-03 13:26:25 +00:00
|
|
|
<!-- currentTiddler is the palette to use -->
|
2024-10-25 09:28:33 +01:00
|
|
|
<<palette-preview-thumbnail>>
|