mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-01-08 08:20:27 +00:00
Avoid redefining the colour function by adding a configuration variable
This commit is contained in:
parent
f88915728f
commit
4e2f2bebd0
@ -3,25 +3,24 @@ tags: $:/tags/Macro
|
|||||||
|
|
||||||
\procedure actions-compile-palette(inputTitle,outputTitle)
|
\procedure actions-compile-palette(inputTitle,outputTitle)
|
||||||
<!-- Redefine colour function to use the input palette -->
|
<!-- Redefine colour function to use the input palette -->
|
||||||
\function colour(name)
|
<$let tv-palette-name=<<inputTitle>>>
|
||||||
[<inputTitle>getindex<name>] :else[[$:/config/DefaultColourMappings/]addsuffix<name>get[text]]
|
<!-- Process modern filter-based palettes -->
|
||||||
\end colour
|
<%if [<inputTitle>get[palette-type]match[modern]] %>
|
||||||
<!-- Process modern filter-based palettes -->
|
|
||||||
<%if [<inputTitle>get[palette-type]match[modern]] %>
|
|
||||||
<$list filter="[<inputTitle>indexes[]sort[]]" variable="colour-name">
|
<$list filter="[<inputTitle>indexes[]sort[]]" variable="colour-name">
|
||||||
<$let colour-filter={{{ [<inputTitle>getindex<colour-name>] }}}>
|
<$let colour-filter={{{ [<inputTitle>getindex<colour-name>] }}}>
|
||||||
<!-- Note the join, needed to cope with palette entries containing spaces -->
|
<!-- Note the join, needed to cope with palette entries containing spaces -->
|
||||||
<$action-setfield $tiddler=<<outputTitle>> $index=<<colour-name>> $value={{{ [subfilter<colour-filter>join[ ]] }}}/>
|
<$action-setfield $tiddler=<<outputTitle>> $index=<<colour-name>> $value={{{ [subfilter<colour-filter>join[ ]] }}}/>
|
||||||
</$let>
|
</$let>
|
||||||
</$list>
|
</$list>
|
||||||
<%else%>
|
<%else%>
|
||||||
<!-- Process legacy wikified palettes -->
|
<!-- Process legacy wikified palettes -->
|
||||||
<$list filter="[<inputTitle>indexes[]sort[]]" variable="colour-name">
|
<$list filter="[<inputTitle>indexes[]sort[]]" variable="colour-name">
|
||||||
<$wikify name="colour-value" text={{{ [<inputTitle>getindex<colour-name>] }}} mode="inline">
|
<$wikify name="colour-value" text={{{ [<inputTitle>getindex<colour-name>] }}} mode="inline">
|
||||||
<$action-setfield $tiddler=<<outputTitle>> $index=<<colour-name>> $value=<<colour-value>>/>
|
<$action-setfield $tiddler=<<outputTitle>> $index=<<colour-name>> $value=<<colour-value>>/>
|
||||||
</$wikify>
|
</$wikify>
|
||||||
</$list>
|
</$list>
|
||||||
<%endif%>
|
<%endif%>
|
||||||
|
</$let>
|
||||||
\end actions-compile-palette
|
\end actions-compile-palette
|
||||||
|
|
||||||
\procedure actions-switch-colour-palette(paletteTitle)
|
\procedure actions-switch-colour-palette(paletteTitle)
|
||||||
@ -32,8 +31,10 @@ tags: $:/tags/Macro
|
|||||||
<$transclude $variable="actions-compile-palette" inputTitle=<<paletteTitle>> outputTitle="$:/temp/palette-colours"/>
|
<$transclude $variable="actions-compile-palette" inputTitle=<<paletteTitle>> outputTitle="$:/temp/palette-colours"/>
|
||||||
\end actions-switch-colour-palette
|
\end actions-switch-colour-palette
|
||||||
|
|
||||||
|
\procedure tv-palette-name() $:/temp/palette-colours
|
||||||
|
|
||||||
\function colour(name)
|
\function colour(name)
|
||||||
[[$:/temp/palette-colours]getindex<name>] :else[[$:/config/DefaultColourMappings/]addsuffix<name>get[text]]
|
[<tv-palette-name>getindex<name>] :else[[$:/config/DefaultColourMappings/]addsuffix<name>get[text]]
|
||||||
\end colour
|
\end colour
|
||||||
|
|
||||||
\function color(name)
|
\function color(name)
|
||||||
|
Loading…
Reference in New Issue
Block a user