1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-01-09 00:40:26 +00:00

Avoid redefining the colour function by adding a configuration variable

This commit is contained in:
Jeremy Ruston 2024-11-09 17:02:00 +00:00
parent f88915728f
commit 4e2f2bebd0

View File

@ -3,9 +3,7 @@ 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]]
\end colour
<!-- Process modern filter-based palettes --> <!-- Process modern filter-based palettes -->
<%if [<inputTitle>get[palette-type]match[modern]] %> <%if [<inputTitle>get[palette-type]match[modern]] %>
<$list filter="[<inputTitle>indexes[]sort[]]" variable="colour-name"> <$list filter="[<inputTitle>indexes[]sort[]]" variable="colour-name">
@ -22,6 +20,7 @@ tags: $:/tags/Macro
</$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)