More class for toggle class macro

Twine Version: 2.3.9
Story Format: SugarCube2 2.33.2

i knew there’s macro for toggle single class like this <<toggleclass "html" "black-theme">>

but how to toggle 2 or 3 different classes ? in this case i want add 3 themes for my game just by clicking the button to change class by toggle it

Simply specify all three, as explained in the docs. For example:

<<toggleclass "html" "black-theme white-theme beige-theme">>

it doesn’t work
<span class="ui-theme" title="Toggle Theme"><i class="fad fa-adjust"></i><<link 'theme'>><<toggleclass "html" "black-theme white-theme baige-theme">><</link>></span>

its toggle but on all class, i mean class black-theme white-theme baige-theme toggle together not one by one

Your original post wasn’t entirely clear. If you meant to alternate between classes, then that’s more cycling than toggling.

Honestly, I’d simply use the Setting.addList() API, there’s an example of this very thing there.

That said, you could do something like the following: (untested, written on my phone)

<<link "Theme">>
<<removeclass "html" $theme>>
<<set _next to 1 + setup.themes.indexOf($theme)>>
<<if _next is setup.themes.length>><<set _next to 0>><</if>>
<<set $theme to setup.themes[_next]>>
<<addclass "html" $theme>>
<</link>>

That requires you to also set setup.themes to an array of theme classes and initialize $theme: (e.g., in StoryInit)

<<set setup.themes to ["black-theme", "white-theme", "beige-theme"]>>
<<set $theme to setup.themes[0]>>

NOTE: The above doesn’t persist the selected theme, as using the Setting API would. That said, doing so is possible using the memorize() and recall() functions.

awesome, this is what i need and it’s works. thx