data-theme set the widget's theme once, when it loaded, and auto followed the visitor's operating system. A site with its own light/dark switch had no way to take the widget with it: flip the page to dark, and a white chat panel stayed in the corner until the next reload.
Switch it while it runs
KookeeChat.setTheme('dark'); // 'light', 'dark' or 'auto'
Call it from your theme toggle. The widget re-themes in place: an open panel stays open, and an answer that is still streaming keeps streaming. Until now the only way was destroy() and init() again, which closed the panel and cut the answer off.
It works before
init(), and wins overdata-theme/themewhichever ran first.destroy()forgets it.A "system" choice in your toggle maps to
'auto'.If you use the queueing stub and call it before the script loads, add
'setTheme'to the stub's list. The snippet on the AI Chat page already has it.
In React nothing changes: the theme prop of KookeeChatWidget was already live.
Getting it
The script tag at kookee.dev/chat/latest.js already has it. The setTheme() type ships in @kookee/react 1.8.3 (with @kookee/sdk 1.8.3), for TypeScript projects that declare the KookeeChat global from the package.
See Customize the chat widget's appearance for the theme options, and Control the chat widget from JavaScript for the full API.