Branding and Theming

The Agentforce Android SDK provides comprehensive theming capabilities for customizing the visual appearance of all UI components.

The Agentforce Android SDK includes a sophisticated theming system built on top of Salesforce's design system. The theming system provides:

  • Color Theming: Complete color palette customization with semantic tokens
  • Light/Dark Mode Support: Automatic switching and explicit mode setting
  • System Integration: Adapts to Android system theme preferences
  • Reactive Updates: Composable state management for real-time theme changes
  • AgentforceThemeManager: Central theme management interface
  • AgentforceColors: Class for color palettes with semantic color tokens
  • AgentforceDarkColors: Dark mode color variants
  • AgentforceThemeCreator: Factory for creating theme objects
  • DefaultAgentforceTheme: Default theme object with Agentforce colors

The theming system provides comprehensive color tokens organized by purpose:

  • surface1: Primary view background
  • surface2: Secondary view background
  • surfaceContainer1: Default container background (cards, modals)
  • surfaceContainer2: Darker container background
  • surfaceContainer3: Darkest container background
  • onSurface1: Lightest text/icon fill (body text, labels)
  • onSurface2: Darker text/icon fill (headings, input fields)
  • onSurface3: Additional text/icon variant
  • accent1: Button icons and interactive elements
  • accent2: Links, hover states, primary actions
  • accent3: Selected states
  • accentContainer1: Branded button backgrounds
  • onAccent1: Text/icons on accent containers
  • error1: Error text and icons
  • errorContainer1: Error alert backgrounds
  • onError1: Text on error containers
  • borderError1: Error button borders
  • successContainer1: Success alert backgrounds
  • onSuccess1: Success text and icons
  • borderSuccess1: Success button borders
  • disabledContainer1: Disabled white component backgrounds
  • disabledContainer2: Disabled dark component backgrounds
  • onDisabled1: Text on light disabled containers
  • onDisabled2: Text on dark disabled containers
  • brandBase50: Primary brand color
  • errorBase50: Error brand color
  • feedbackWarning1: Warning text color
  • feedbackWarningContainer1: Warning container background
  • info1: Information text color
  • infoContainer1: Information container background

The following sections show how to implement theming in your Android application.

Important: Currently, only color theming is supported. Fonts, dimensions, and shapes are not yet implemented in the theming system.

The following best practices ensure effective theming implementation.

  1. Use Semantic Colors: Always use semantic color tokens rather than hardcoded colors
  2. Test Both Modes: Ensure your custom colors work well in both light and dark modes
  3. System Integration: Use AgentforceThemeMode.SYSTEM to respect user preferences
  4. Copy Function: Use the copy() function to modify existing colors rather than creating from scratch
  5. Accessibility: Ensure sufficient color contrast for accessibility compliance
  6. Feature Flags: Use feature flags to gradually roll out custom theming
  • UI Components: See Android UI Components for component theming
  • Configuration: See AgentforceConfiguration for setup
  • Integration: See Android Development for architecture patterns