Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions src/examples/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down