Skip to main content
The Ansa widget supports light, dark, and system (auto-detect) themes, ensuring your chat widget matches your website’s appearance or your visitors’ preferences.

Theme Options


Configuring Theme in Dashboard

  1. Go to your agent’s Embed page
  2. Under Appearance, find the Theme dropdown
  3. Select your preferred theme:
    • Light — Forces light mode
    • Dark — Forces dark mode
    • System (auto-detect) — Matches visitor’s OS preference
New agents default to System theme, which automatically adapts to your visitors’ light/dark mode preference.

How System Theme Detection Works

When theme is set to system, the widget:
  1. Checks the visitor’s OS preference using prefers-color-scheme media query
  2. Listens for real-time changes (e.g., when user toggles system dark mode)
  3. Automatically updates the widget appearance without page refresh
This provides the best experience for visitors who prefer dark mode on their devices.

JavaScript API

You can control the widget theme programmatically using JavaScript:

Set Theme

Get Current Theme

Example: Sync with Website Theme Toggle

Example: Match Website Theme on Load


Dark Mode Colors

When in dark mode, the widget uses these colors: Your primary color and chat bubble color (configured in Appearance settings) remain consistent across both themes.

Best Practices

The system theme provides the best user experience as it respects visitors’ preferences. Many users enable dark mode system-wide, and matching this preference reduces eye strain.
If your website has a fixed light or dark theme, set the widget to match. Use setTheme() if your website has a theme toggle.
Always preview your widget in both light and dark modes to ensure your branding colors (primary color, chat bubble color) look good in both contexts.
If using a very light primary color, it will automatically use dark text for contrast. The widget handles this automatically.