Saq et al,
I love these semi-competitive focused coding task threads. I like to generalise and simplify too,
As a result I seem to have identified that the new toggle operator and parameters is not accepting this form (as in Saq's example)
text={{{[{$:/palette}toggle<lightPalette>,<
darkPalette>] }}}/>
Is this a bug, limitation or a restriction?
Although; this generalised toggle does work
\define toggle-text(tiddler value1 value2)
<$button>Day/Night IV
<$action-setfield $tiddler="$tiddler$" text={{{ [[$tiddler$]get[text]] +[toggle[$value1$],[$value2$]] }}}/>
</$button>
\end
<<toggle-text "$:/palette" "$:/palettes/Vanilla" "$:/palettes/SolarFlare" >>
Since the above is worthy of a reusable global macro placing the macro definition in a tiddler tagged $:/tags/Macro
Then create a tiddler day-night containing;
<<toggle-text "$:/palette" "$:/palettes/Vanilla" "$:/palettes/SolarFlare" >>
Then wherever you want the day night toggle just use
{{night-day}}
Your comments please!
This approach of mine is designed to capture functionality in a way it is very easy to use.
- I would invite my coding companions to consider the development of some de facto standards
- The find a way to easily package it to other to acquire it (I have some already)
- For a complete solution I would look at displaying the button as a icon that changes color eg red/green
Regards
Tones