Theme Mode

enum class AgentforceThemeMode

Controls whether the SDK renders its light palette, its dark palette, or follows the device's system setting.

Declared in package com.salesforce.android.agentforcesdk.components.theme.

Members

Member Description
SYSTEM Follow the device's light/dark setting. Recomposes automatically when the setting changes.
LIGHT Always render the light palette, regardless of the device setting.
DARK Always render the dark palette, regardless of the device setting.

Setting the mode

Set themeMode on AgentforceThemeOverrides or pass it to createCustomAgentforceThemeManager(...):

import com.salesforce.android.agentforcesdk.components.theme.AgentforceThemeMode
import com.salesforce.android.agentforcesdk.components.theme.AgentforceThemeOverrides

val overrides = AgentforceThemeOverrides(
    themeMode = AgentforceThemeMode.SYSTEM, // or LIGHT / DARK
)

If you don't set themeMode, createDefaultAgentforceThemeManager() uses LIGHT and createCustomAgentforceThemeManager(...) defaults to SYSTEM.

Reading the resolved mode

AgentforceThemeManager.getThemeMode() returns the configured mode as-is, without resolving SYSTEM. To find out which palette is actually rendering — including the resolved value when the mode is SYSTEM — call the composable isDarkMode() instead:

val theme = LocalAgentforceTheme.current
val isDark = theme.isDarkMode()

Notes

  • Theme mode always comes from your app's configuration, falling back to the SDK default.
  • Test your theme in both light and dark mode, and check color contrast in each (WCAG AA).

See also