AgentforceThemeManager

interface AgentforceThemeManager

The central theme contract. A theme manager holds a fully resolved theme — both color palettes, typography, shapes, dimensions, shadows, the theme mode, and any icon or display-name overrides — and exposes the values the SDK's UI reads at render time.

All theming types live in the package com.salesforce.android.agentforcesdk.components.theme.

You don't implement this interface. Obtain an instance from one of the factory functions below, or let the SDK build one for you from an AgentforceThemeOverrides bag.

Members

Member Signature Description
colors @Composable fun colors(): AgentforceColorPalette The palette for the currently rendering theme mode. Call from a composable.
colors fun colors(isDarkMode: Boolean): AgentforceColorPalette The palette for the given dark-mode flag. Call from outside composition. A forced LIGHT or DARK theme mode ignores the flag.
typography fun typography(): Typography The active text styles.
shapes fun shapes(): Shapes The active corner shapes.
dimensions fun dimensions(): Dimensions The active spacing and sizing values.
shadows fun shadows(): Shadows The active elevation shadows.
getIcon fun getIcon(iconType: AgentforceIconType): AgentforceIcon? The custom icon for a slot, or null when the SDK's built-in drawable applies.
getDisplayName fun getDisplayName(displayNameType: AgentforceDisplayNameType): String? The custom string for a slot, or null when the SDK's built-in string resource applies. An empty override is treated as unset.
getThemeMode fun getThemeMode(): AgentforceThemeMode The configured mode, returned as-is without resolving SYSTEM.
isDarkMode @Composable fun isDarkMode(): Boolean Whether dark colors are actually rendering, resolving SYSTEM against the device setting.

Typography, Shapes, Dimensions, and Shadows come from the Salesforce SharedUI design system (com.salesforce.android.sharedui.theme). AgentforceColorPalette is defined by the SDK.

Factory functions

Function Signature Description
createDefaultAgentforceThemeManager fun createDefaultAgentforceThemeManager(): AgentforceThemeManager The out-of-the-box Agentforce theme. Theme mode is LIGHT.
createCustomAgentforceThemeManager see below A manager with any subset of overrides. Every parameter left null falls back to the corresponding Agentforce default. Theme mode defaults to SYSTEM.
fun createCustomAgentforceThemeManager(
    lightColors: AgentforceColorPalette? = null,
    darkColors: AgentforceColorPalette? = null,
    shapes: Shapes? = null,
    dimensions: Dimensions? = null,
    typography: Typography? = null,
    shadows: Shadows? = null,
    themeMode: AgentforceThemeMode? = null,
    icons: Map<AgentforceIconType, AgentforceIcon>? = null,
    displayNames: Map<AgentforceDisplayNameType, String>? = null
): AgentforceThemeManager

Supplying a theme

Pass your theme to AgentforceConfiguration.Builder.setTheming(...) using the sealed AgentforceTheming type. A theme manager is only one of the three options, and usually not the one you want.

Option When to use
AgentforceTheming.Overrides (recommended) Tweak specific tokens and let everything else follow the SDK defaults. Any token you leave out keeps its default.
AgentforceTheming.CustomManager Own the entire theme end-to-end with a fully resolved manager.
AgentforceTheming.Default No in-code theme — the SDK default theme is used.
val manager = createCustomAgentforceThemeManager(
    lightColors = myLight,
    darkColors = myDark,
    typography = AgentforceTypography.Default.copyWithFontFamily(brandFont),
    themeMode = AgentforceThemeMode.SYSTEM,
)

val configuration = AgentforceConfiguration.builder(authCredentialProvider)
    .setApplication(application)
    .setSalesforceDomain("https://your-instance.salesforce.com")
    .setTheming(AgentforceTheming.CustomManager(manager))
    .build()

A resolved manager carries no "unset" signal — every value is already concrete, so there is no way to say "leave this one alone." Prefer AgentforceTheming.Overrides unless you genuinely need to own the whole theme.

Reading theme values in your own components

The active manager is published through a Compose CompositionLocal, so custom components rendered inside the chat can match the theme. If no manager is provided, the local falls back to createDefaultAgentforceThemeManager(), which keeps components working in isolation and in tests.

val theme = LocalAgentforceTheme.current
val colors = theme.colors()
val typography = theme.typography()

Text(
    text = "Hello",
    style = typography.bodyFontScale1Regular.copy(color = colors.onSurface1),
)

Migration notes

  • AgentforceThemeCreator and DefaultAgentforceTheme are no longer part of the SDK. Use createDefaultAgentforceThemeManager() and createCustomAgentforceThemeManager(...) instead.
  • AgentforceConfiguration.Builder.setThemeManager(...) and setThemeOverrides(...) are deprecated in favor of the single setTheming(...) entry point.

See also