From 4e2f2bebd0f63cd34b5ef26af2637f6f4610be8d Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Sat, 9 Nov 2024 17:02:00 +0000 Subject: [PATCH] Avoid redefining the colour function by adding a configuration variable --- core/wiki/macros/CSS.tid | 41 ++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/core/wiki/macros/CSS.tid b/core/wiki/macros/CSS.tid index 92c349665..6a68c77e8 100644 --- a/core/wiki/macros/CSS.tid +++ b/core/wiki/macros/CSS.tid @@ -3,25 +3,24 @@ tags: $:/tags/Macro \procedure actions-compile-palette(inputTitle,outputTitle) -\function colour(name) - [getindex] :else[[$:/config/DefaultColourMappings/]addsuffixget[text]] -\end colour - -<%if [get[palette-type]match[modern]] %> - <$list filter="[indexes[]sort[]]" variable="colour-name"> - <$let colour-filter={{{ [getindex] }}}> - - <$action-setfield $tiddler=<> $index=<> $value={{{ [subfilterjoin[ ]] }}}/> - - -<%else%> - - <$list filter="[indexes[]sort[]]" variable="colour-name"> - <$wikify name="colour-value" text={{{ [getindex] }}} mode="inline"> - <$action-setfield $tiddler=<> $index=<> $value=<>/> - - -<%endif%> +<$let tv-palette-name=<>> + + <%if [get[palette-type]match[modern]] %> + <$list filter="[indexes[]sort[]]" variable="colour-name"> + <$let colour-filter={{{ [getindex] }}}> + + <$action-setfield $tiddler=<> $index=<> $value={{{ [subfilterjoin[ ]] }}}/> + + + <%else%> + + <$list filter="[indexes[]sort[]]" variable="colour-name"> + <$wikify name="colour-value" text={{{ [getindex] }}} mode="inline"> + <$action-setfield $tiddler=<> $index=<> $value=<>/> + + + <%endif%> + \end actions-compile-palette \procedure actions-switch-colour-palette(paletteTitle) @@ -32,8 +31,10 @@ tags: $:/tags/Macro <$transclude $variable="actions-compile-palette" inputTitle=<> outputTitle="$:/temp/palette-colours"/> \end actions-switch-colour-palette +\procedure tv-palette-name() $:/temp/palette-colours + \function colour(name) -[[$:/temp/palette-colours]getindex] :else[[$:/config/DefaultColourMappings/]addsuffixget[text]] +[getindex] :else[[$:/config/DefaultColourMappings/]addsuffixget[text]] \end colour \function color(name)