diff --git a/src/examples/styles.ts b/src/examples/styles.ts index 5f51e6d..9eb251e 100644 --- a/src/examples/styles.ts +++ b/src/examples/styles.ts @@ -341,6 +341,39 @@ export const Styles = { }, }, + Themes: { + getThemeAndStyles: async () => { + // Get the current theme + const theme = await webflow.getTheme() + console.log('Current theme:', theme) + + // Get the resolved design tokens for the current theme + const themeStyles = await webflow.getThemeStyles(theme) + console.log('Theme styles:', themeStyles) + }, + + subscribeCurrentTheme: async () => { + // Set initial theme + const theme = await webflow.getTheme() + const styles = await webflow.getThemeStyles(theme) + console.log('Initial theme:', theme) + console.log('Initial theme styles:', styles) + + // Subscribe to theme changes + const unsubscribe = webflow.subscribe( + 'currenttheme', + async (newTheme) => { + const newStyles = await webflow.getThemeStyles(newTheme) + console.log('Theme changed:', newTheme) + console.log('New theme styles:', newStyles) + }, + ) + + // Stop listening after 10 seconds + setTimeout(unsubscribe, 10000) + }, + }, + VariableModes: { // Variable Modes