mirror of
				https://github.com/Jermolene/TiddlyWiki5
				synced 2025-10-30 23:23:02 +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:
		| @@ -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; | ||||
| 		} | ||||
| 	}; | ||||
| }; | ||||
|  | ||||
|   | ||||
| @@ -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)$; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Jeremy Ruston
					Jeremy Ruston