I want to return a color based on the user input: *x*

x <= -5   color:red
x < 0     color:yellow
x = 0     color:grey
x > 0     color:blue
x >= 5    color:green

As a test, I have implemented the below solution.

*<$vars x=-3>*<!-- change x here -->
<$list filter="[<x>compare:number:lt[0]then[yellow]]
[<x>compare:number:lteq[-5]then[red]] [<x>compare:number:gt[0]then[blue]]
[<x>compare:number:gteq[5]then[green]] +[last[]]" emptyMessage=grey>
<<currentTiddler>>
</$list>
</$vars>

Copy paste in an empty tiddler in https://tiddlywiki.com/ and change x and
see the result, it works fine, but seems a lengthy solution.
What simpler, more semantic alternative do you propose?


Best wishes
Mohammad

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/CAAV1gMDBFhkhurS6FbFciAhqse7c%2B4b4dUJyoyfE_wfPKCscpQ%40mail.gmail.com.

Reply via email to