how to change background picture using a button?

60 views
Skip to first unread message

Tzela Yaish

unread,
Feb 19, 2021, 2:36:49 PM2/19/21
to TiddlyWiki
I have a button to switch between dark and light mode, but I also have a background picture and not a default background color.
How do I change the background picture in click of button? 

thank you !

Soren Bjornstad

unread,
Feb 20, 2021, 4:31:16 PM2/20/21
to TiddlyWiki
How about this:

<$button set="$:/themes/tiddlywiki/vanilla/settings/backgroundimage" setTo="FirstImageTiddler">
    Image 1
</$button>
<$button set="$:/themes/tiddlywiki/vanilla/settings/backgroundimage" setTo="SecondImageTiddler">
    Image 2
</$button>

If you want an action widget instead because you want to be able to do multiple actions on the same widget, you could instead use an $action-setfield widget, like:

\define setAction(imageName) <$action-setfield $tiddler="$:/themes/tiddlywiki/vanilla/settings/backgroundimage" text="""$imageName$"""/>

<$button actions=<<setAction "FirstImageTiddler">>>
    Image 1
</$button>

Reply all
Reply to author
Forward
0 new messages