1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-30 05:19:57 +00:00

Rewrite colour macro as a function

Using the new wikify operator.

Currently has a bug whereby redirected colours (like "tiddler-background") do not work. Direct colours like "background" do work.

Note the hacks needed to makeFakeWidgetWithVariables work
This commit is contained in:
Jeremy Ruston 2024-10-22 17:26:04 +01:00
parent 467a1a47cc
commit a23ee165d8
2 changed files with 11 additions and 10 deletions

View File

@ -341,7 +341,11 @@ Widget.prototype.makeFakeWidgetWithVariables = function(variables) {
},
makeFakeWidgetWithVariables: self.makeFakeWidgetWithVariables,
resolveVariableParameters: self.resolveVariableParameters,
wiki: self.wiki
wiki: self.wiki,
variables: variables,
getAncestorCount: function() {
return 0;
}
};
};

View File

@ -2,16 +2,13 @@ title: $:/core/macros/CSS
tags: $:/tags/Macro $:/tags/Global
<!-- Needs to stay that way for backwards compatibility. See GH issue: #8326 -->
\define colour(name)
\whitespace trim
<$transclude tiddler={{$:/palette}} index="$name$">
<$transclude tiddler="$:/palettes/Vanilla" index="$name$">
<$transclude tiddler="$:/config/DefaultColourMappings/$name$"/>
</$transclude>
</$transclude>
\end
\function colour(name)
[{$:/palette}getindex<name>] :else[{$:/palettes/Vanilla}getindex<name>] :else[[$:/config/DefaultColourMappings/]addsuffix<name>get[text]] :and[wikify[text],[inline]]
\end colour
\define color(name) <<colour $name$>>
\function color(name)
[function[colour],<name>]
\end function
\function box-shadow(shadow)
[[ -webkit-box-shadow: $(shadow)$;