Dark mode needs the JavaScript SDK v19.0.0 or newer.
Set up dark mode
Open your project in the Gleap dashboard, go to Widget → Look & feel and turn on Adapt to dark / light mode. The widget then has its own settings for each mode. Switch between them with the Light mode and Dark mode tabs:- Header colors: the colors of the selected header style (Color, Tri-color, or the header color of the Image style).
- UI color: buttons, links and highlights inside the widget.
- Background color: the widget body behind the content.
- Background image: the header image of the Image style.
- Header logo
- Composer glow colors: the glow around the message composer (Agentic v4, with Composer glow turned on).
While Adapt to dark / light mode is turned off, the widget always uses its normal colors, even if your app requests a color scheme by code. Dark mode also needs dark colors in the dashboard; without them the widget keeps its normal colors.
Automatic detection
With Adapt to dark / light mode turned on, Gleap detects the theme of your page in this order:- Theme markers on
<html>: the theme attributesdata-theme,data-bs-theme,data-color-scheme,data-color-mode,data-modeanddata-mui-color-scheme(a value containingdarkorlight), then the theme classesdark,dark-mode,dark-theme,theme-darkand the light equivalentslight,light-mode,light-theme,theme-light. - The same theme markers on
<body>. - The CSS
color-schemeproperty of<html>(only if it is set to eitherlightordark). - The background color of your page.
- The operating system preference (
prefers-color-scheme).
Set the color scheme by code
If your app has its own theme toggle, you can set the color scheme by code. Possible values are"auto" (automatic detection), "light" and "dark". Before the first call, the dashboard setting applies; "auto" makes the widget follow the theme of your page again.
lightBackgroundColor and darkBackgroundColor (#rrggbb or #rgb) override the background color of the respective mode. The method can be called before or after Gleap.initialize(), and changes are applied immediately.
setColorScheme only takes effect while Adapt to dark / light mode is turned on in the dashboard.darkBackgroundColor passed by code is enough on its own.