Code sample to enable dark mode in Android | Community
Skip to main content
Answered

Code sample to enable dark mode in Android

  • July 16, 2025
  • 10 replies
  • 210 views

Can I please have a code sample on how to implement dark mode (or switch themes) for Android. E.g. something like

import io.intercom.android.sdk.ui.theme.ThemeMode;

Intercom.client().setThemeMode(ThemeMode.DARK);

I noted that Dark Mode was enabled on Android SDK v17.0.0

Best answer by lsmith

Got it working by forcing the UI module. See photos below.

10 replies

Forum|alt.badge.img+7
  • Intercom Team
  • 255 replies
  • July 23, 2025

Hi ​@Ron Dul ! Ebenezer here from Engineering Support👋.

  • The SDK uses a ThemeManager to determine the current theme mode (light, dark, or system/default).
  • The IntercomTheme composable applies the correct color palette based on the theme mode.
  • Utility functions are provided to select the appropriate color for the current theme, both in Compose and non-Compose contexts.
  • You can override the theme mode at runtime (e.g., to allow users to toggle between light and dark modes within your app).

You can set the theme mode using the ThemeManager. For example, to force dark mode:

import io.intercom.android.sdk.ui.theme.ThemeManager
import io.intercom.android.sdk.ui.theme.ThemeMode

// To force dark mode
ThemeManager.setSessionOverride(ThemeMode.DARK)

// To force light mode
ThemeManager.setSessionOverride(ThemeMode.LIGHT)

// To follow the system theme
ThemeManager.setSessionOverride(ThemeMode.SYSTEM)

 

If you are using Jetpack Compose, wrap your Intercom Messenger UI in the IntercomTheme composable. The theme will automatically adapt based on the current theme mode:

import io.intercom.android.sdk.ui.theme.IntercomTheme

IntercomTheme {
    // Place your Intercom Messenger UI here
}

 

If you need to select colors manually (e.g., for custom UI elements), use the provided utility:

import io.intercom.android.sdk.utilities.ThemeUtils

val color = ThemeUtils.selectColorForTheme(context, "#FFFFFF", "#14161a")


  • Author
  • New Participant
  • 2 replies
  • July 23, 2025

Thank you, that is very helpful.


  • Author
  • New Participant
  • 2 replies
  • August 19, 2025

When using Intercom Android SDK 17.1.0 we aren’t able to import the ThemeManager and ThemeMode — as if the “ui” folder isn’t included in the SDK package?

Error: “Cannot resolve symbol 'theme'”

Many thanks


Forum|alt.badge.img
  • Connector
  • 7 replies
  • October 25, 2025

@Ebenezer.Laleye , I’m seeing the same issue as ​@Ron Dul .

I’m using the `17.3.0` version of the full Intercom Android SDK but can’t find certain packages.

`setTheme()` can’t be found, nor can the ThemeMode class. 

 

 

Also ​@Ebenezer.Laleye , it’s a bit strange that your original advice at the top of this thread isn’t in the formal docs at https://developers.intercom.com/installing-intercom/android/using-intercom#set-theme-mode. The advice is very important and useful for the theme topic, especially as more and more folks use Compose.

 


Forum|alt.badge.img
  • Connector
  • 7 replies
  • October 25, 2025



What I’ve got in my Proguard file and my package setup in my .toml file​​​​​​

 


Forum|alt.badge.img
  • Connector
  • 7 replies
  • October 27, 2025

cc ​@Sean M ☝🏼


Forum|alt.badge.img
  • Connector
  • 7 replies
  • October 28, 2025

 ​@Sean M ​@Ebenezer.Laleye 

Here are my latest thoughts:

Consider updating the SDK's POM file to include `intercom-sdk-ui` as an `api` dependency rather than `implementation`, ensuring it's always available in the compile classpath for consuming projects. This would prevent this issue from occurring for other developers.

Alternatively, update documentation to explicitly state that `intercom-sdk-ui` must be declared as a separate dependency when using UI-related classes like `ThemeMode`.

 


Forum|alt.badge.img
  • Connector
  • 7 replies
  • October 28, 2025

see below ​@Sean M ​@Ebenezer.Laleye 

 


Forum|alt.badge.img
  • Connector
  • 7 replies
  • Answer
  • October 28, 2025

Got it working by forcing the UI module. See photos below.


Forum|alt.badge.img
  • Connector
  • 7 replies
  • November 11, 2025

 ​@Sean M ​@Ebenezer.Laleye 

Someone at Intercom marked my comment above as “the answer”. This is a cop out. I shouldn’t HAVE to do all of these workarounds to get access to the UI files. Is Intercom going to fix the package distribution so that other engineers and I don’t have to find this exact Intercom community thread and do these workarounds? At the very least, is Intercom going to update the Android documentation?