Skip to content

Custom Theming

You can customize the appearance of Pulsate’s In App messages so they fit your brand. Colors are applied at runtime through the PULPulsateManager theming API.

Build a PULThemeConfiguration, set the color fields you want to override, and apply it all at once:

import PULPulsate
import UIKit
guard let manager = PULPulsateFactory.getDefaultInstance() else { return }
let config = PULThemeConfiguration()
config.bigInAppOneButtonColor = .red
config.bigInAppOneButtonTextColor = .white
manager.applyThemeConfiguration(config)

You can also set colors one at a time with the dedicated setters:

manager.setSmallInAppMessageBackgroundColor(.systemBackground)
manager.setBigInAppHeaderColor(.systemBlue)
manager.setBigInAppMessageBackgroundColor(.systemBackground)
manager.setBigInAppOneButtonColor(.red)
manager.setBigInAppOneButtonTextColor(.white)
manager.setBigInAppTwoButtonColor(.clear)
manager.setBigInAppTwoButtonTextColor(.red)
manager.setBigInAppTwoButtonOutlineColor(.red)

To set a color by key — for example when driving theming from your own configuration — use a typed PULThemeKey or a string key:

// Typed key
manager.setCustomColorWithThemeKey(.bigInAppHeader, color: .red)
// String key
manager.setCustomColor(forKey: "pulsate_big_in_app_header_color", color: .red)

Call getThemeConfigurationKeys() to list the available color keys at runtime.

To revert every custom color back to the SDK defaults:

manager.resetThemeColors()

By default the user avatar uses the user’s initials when possible, falling back to an anonymous icon. You can disable initials so the avatar is always the anonymous icon, even when first and last name are set. Configure this at startup, for example in your AppDelegate’s didFinishLaunchingWithOptions:

manager.useInitials(forUserAvatar: false)

Read the current preference with getUseInitialsForUserAvatar().