cdruan / tw5-captivate

TiddlyWiki theme with easy color customization
https://cdruan.github.io/tw5-captivate/
MIT License
17 stars 3 forks source link

How to create a button to cycle through different colour schemes of the capaivate theme. #7

Closed arunnbabu81 closed 1 year ago

arunnbabu81 commented 1 year ago

https://sidetabs-wiki.tiddlyhost.com/#buttons%2Fcycle-palettes

Here is a palette cycle button I found in the google group sometime back (Don't remember the creators name, might be Mohammed). Can such a pagecontrol button be used to cycle through different colour schemes of the capaivate theme.

cdruan commented 1 year ago

I've looked into how cycle-palettes works. The button cycles through all palettes tagged with $:/tags/Palette.

What you can do is to choose (i.e. activate) a particular color scheme via Captivate Theme Tweaks section in the Control Panel. The action will re-generate the $:/palettes/Captivate(Dark,Light,Tan) palettes for the given color scheme. Clone any captivate palette ($:/palettes/CaptivateDark, $:/palettes/CaptivateLight, $:/palettes/CaptivateTan) that you'd like to cycle through . Make sure the names of the cloned palettes do NOT contain any space characters.

Repeat the above process for another color scheme.

arunnbabu81 commented 1 year ago

My doubt was how to cycle through different color schemes using a cycle button after setting Captivate light or tan or dark palette

What you can do is to choose (i.e. activate) a particular color scheme via Captivate Theme Tweaks section in the Control Panel. The action will re-generate the $:/palettes/Captivate(Dark,Light,Tan) palettes for the given color scheme. Clone any captivate palette ($:/palettes/CaptivateDark, $:/palettes/CaptivateLight, $:/palettes/CaptivateTan) that you'd like to cycle through . Make sure the names of the cloned palettes do NOT contain any space characters.

I will try this out.

arunnbabu81 commented 1 year ago
\whitespace trim
\define cycle-palettes()
<$set name=pals filter="[all[tiddlers+shadows]prefix[$:/palettes/Captivate]]">
<$action-listops $tiddler="$:/palette" $field="text" $subfilter="+[cycle<pals>]"/>
</$set>
\end

\define cycle-captivate-palette-button()
<$wikify name=tooltip text={{$:/language/Buttons/CyclePalettes/Hint}}>
<$button actions=<<cycle-palettes>> 
 tooltip=<<tooltip>>
 aria-label={{$:/language/Buttons/CyclePalettes/Caption}}
 class=<<tv-config-toolbar-class>> >
<$list filter="[<tv-config-toolbar-icons>match[yes]]">
{{$:/images/svg-icon/paintcan}}
</$list>
<$list filter="[<tv-config-toolbar-text>match[yes]]">
<span class="tc-btn-text"><$text text={{$:/language/Buttons/CyclePalettes/Caption}}/></span>
</$list>
</$button>
</$wikify>
\end

<<cycle-captivate-palette-button>>

I am using this code to cycle through captivate palettes after setting a particular colour scheme. Is there a way to cycle through different colour schemes after setting a particular captivate palette ?

arunnbabu81 commented 1 year ago

I've looked into how cycle-palettes works. The button cycles through all palettes tagged with $:/tags/Palette.

What you can do is to choose (i.e. activate) a particular color scheme via Captivate Theme Tweaks section in the Control Panel. The action will re-generate the $:/palettes/Captivate(Dark,Light,Tan) palettes for the given color scheme. Clone any captivate palette ($:/palettes/CaptivateDark, $:/palettes/CaptivateLight, $:/palettes/CaptivateTan) that you'd like to cycle through . Make sure the names of the cloned palettes do NOT contain any space characters.

Repeat the above process for another color scheme.

Now only I really understood what you were saying..and I got it working.