---
sourceDocument: Référence API Brésil
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/fr-FR/api-reference

 Release :

    - brazil

ft:locale :

    - fr-FR

ft:publication_title :

    - Référence API Brésil

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# Protocole NowChatThemeable : iOS

# Protocole NowChatThemeable : iOS {#ariaid-title1}

Rversion finale: Brazil  
Mis à jour 10 sept. 2026  
![](https://www.servicenow.com/docs/portal-asset/ico-clock) 2 minutes de lecture  
Le protocole NowChatThemeable fournit des propriétés qui vous permettent de remplacer les couleurs utilisées dans les pages de messagerie instantanée hébergées sur votre ServiceNow instance.

    public protocol NowChatThemeable {
        var color: NowChatColoring { get }
    }

Le protocole [NowChatColoring](https://servicenow-prod.fluidtopics.net/0JRpvgEVTnMjSDEZCkGj0g#NowChatColoringiOSProtocol "Le protocole NowChatColoring définit les couleurs par défaut des éléments de l’interface utilisateur de Agent virtuel messagerie Agent actif instantanée.") contient NowUIColoring. Cette propriété est utilisée pour référencer les variables de couleur par défaut que NowWebThemeable peut utiliser.

Pour plus d'informations sur le thème de l'interface utilisateur, consultez [Utiliser NowUIColoring pour le thème NowWebTheme et NowChatTheme](https://servicenow-prod.fluidtopics.net/fGcz_En1hAuuix~H7~c45Q "L’interface NowUIColoring contient toutes les couleurs utilisées par tous les modules NowSDK.") le Guide du développeur du SDK Mobile - iOS.

## Définir ChatColors à l'aide des couleurs par défaut {#NowChatThemeableiOSProtocol__section_eqf_nk3_tzb}

    /// Sample structure for using default colors that comes with Mobile SDK.
    struct ChatColors: NowUIColoring {
    }

## Définir ChatColors à l'aide de couleurs personnalisées {#NowChatThemeableiOSProtocol__section_zl2_tk3_tzb}

    /// Use Custom Colors with light theme
    struct ChatColors: NowUIColoring {
        private var defaultTheme: NowChatDefaultTheme {
            NowChatDefaultTheme(nowUITheme: NowUIDefaultTheme())
        }
     
        var brand: UIColor {
            lightBrand
        }
        var primary: UIColor {
            lightPrimary
        }
        var secondary: UIColor {
            lightSecondary
        }
        var textTertiary: UIColor {
            lightTextTertiary
        }
        var destructive: UIColor {
            lightDestructive
        }
        var textPrimary: UIColor {
            lightTextPrimary
        }
        var textSecondary: UIColor {
            lightTextSecondary
        }
        var textActionable: UIColor {
            lightTextActionable
        }
        var screenHeaderText: UIColor {
            lightScreenHeaderText
        }
        var backgroundPrimary: UIColor {
            lightBackgroundPrimary
        }
        var backgroundSecondary: UIColor {
            lightBackgroundSecondary
        }
        var backgroundTertiary: UIColor {
            lightBackgroundTertiary
        }
        var backgroundPrimaryActionable: UIColor {
            lightBackgroundPrimaryActionable
        }
        var backgroundSecondaryActionable: UIColor {
            lightBackgroundSecondaryActionable
        }
        var brandBackground: UIColor {
            lightBrandBackground
        }
        var linkPrimaryText: UIColor {
            lightLinkPrimary
        }
        var linkSecondary: UIColor {
            lightLinkSecondary
        }
        var separatorPrimary: UIColor {
            lightSeparatorPrimary
        }
        var separatorTertiary: UIColor {
            lightSeparatorTertiary
        }
        var borderTertiary: UIColor {
            lightBorderTertiary
        }
        var shadow: UIColor {
            lightShadow
        }
        var notification: UIColor {
            lightNotification
        }
        var alertCritical0: UIColor {
            lightAlertCritical0
        }
        var alertCritical3: UIColor {
            lightAlertCritical3
        }

        // Light Colors
        var lightBrand: UIColor { defaultTheme.color.nowUIColor.brand }
        var lightPrimary: UIColor { defaultTheme.color.nowUIColor.primary }
        var lightSecondary: UIColor { defaultTheme.color.nowUIColor.secondary }
        var lightDestructive: UIColor { defaultTheme.color.nowUIColor.destructive }
        var lightTextPrimary: UIColor { defaultTheme.color.nowUIColor.textPrimary }
        var lightTextSecondary: UIColor { defaultTheme.color.nowUIColor.textSecondary }
        var lightTextTertiary: UIColor { defaultTheme.color.nowUIColor.textTertiary }
        var lightTextActionable: UIColor { defaultTheme.color.nowUIColor.textActionable }
        var lightScreenHeaderText: UIColor { defaultTheme.color.nowUIColor.screenHeaderText }
        var lightBackgroundPrimary: UIColor { defaultTheme.color.nowUIColor.backgroundPrimary }
        var lightBackgroundSecondary: UIColor { defaultTheme.color.nowUIColor.backgroundSecondary }
        var lightBackgroundTertiary: UIColor { defaultTheme.color.nowUIColor.backgroundTertiary }
        var lightBackgroundPrimaryActionable: UIColor { defaultTheme.color.nowUIColor.backgroundPrimaryActionable
        }
        var lightBackgroundSecondaryActionable: UIColor { defaultTheme.color.nowUIColor.backgroundSecondaryActionable
        }
        var lightBrandBackground: UIColor { defaultTheme.color.nowUIColor.brandBackground }
        var lightLinkPrimary: UIColor { defaultTheme.color.nowUIColor.linkPrimaryText }
        var lightLinkSecondary: UIColor { defaultTheme.color.nowUIColor.linkSecondary }
        var lightSeparatorPrimary: UIColor { defaultTheme.color.nowUIColor.separatorPrimary }
        var lightSeparatorTertiary: UIColor { defaultTheme.color.nowUIColor.separatorTertiary }
        var lightBorderTertiary: UIColor { defaultTheme.color.nowUIColor.borderTertiary }
        var lightShadow: UIColor { defaultTheme.color.nowUIColor.shadow }
        var lightNotification: UIColor { defaultTheme.color.nowUIColor.notification }
        var lightAlertCritical0: UIColor { defaultTheme.color.nowUIColor.alertCritical0 }
        var lightAlertCritical3: UIColor { defaultTheme.color.nowUIColor.alertCritical3 }
    }

## Définir la structure ChatTheme avec le protocole NowChatThemeable {#NowChatThemeableiOSProtocol__section_axh_zk3_tzb}

    struct CarrascoChatTheme: NowChatThemeable {
        var color: NowChatColoring
        
        struct Color: NowChatColoring {
            var nowUIColor: NowUIColoring
        
            var backgroundPrimary: UIColor
            var backgroundSecondary: UIColor
            var backgroundPrimaryActionable: UIColor
            var backgroundSecondaryActionable: UIColor
            var brandBackground: UIColor
            var backgroundTertiary: UIColor
            var separatorPrimary: UIColor
            var separatorTertiary: UIColor
            var borderTertiary: UIColor
            var shadow: UIColor
            var linkSecondary: UIColor

            init(inputs: ChatColors) {
                nowUIColor = ThemeColor(inputs)
                
                backgroundPrimary = inputs.backgroundPrimary
                backgroundSecondary = inputs.backgroundSecondary
                backgroundTertiary = inputs.backgroundTertiary
                backgroundPrimaryActionable = inputs.backgroundPrimaryActionable
                backgroundSecondaryActionable = inputs.backgroundSecondaryActionable
                brandBackground = inputs.brandBackground
                separatorPrimary = inputs.separatorPrimary
                separatorTertiary = inputs.separatorTertiary
                borderTertiary = inputs.borderTertiary
                shadow = inputs.shadow
                linkSecondary = inputs.linkSecondary
            }
        }

        init(chatColors: ChatColors) {
            color = Color(inputs: chatColors)
        }
    }

## Instancier l'objet ChatTheme en transmettant ChatColor comme entrée {#NowChatThemeableiOSProtocol__section_ebw_2l3_tzb}

    let chatTheme = CarrascoChatTheme(chatColors: ChatColors())

## Transmettre l'objet ChatTheme à NowChatService.makeChatUI () {#NowChatThemeableiOSProtocol__section_mhd_hl3_tzb}

    func makeChatScreen() -> UIViewController? {
      guard let chatService = chatService else { return nil }
      let result = chatService.makeChatUI(theme: CarrascoChatTheme(chatColors: ChatColors()))
            
      switch result {
      case .success(let chatViewController):
        return chatViewController
      case .failure(let error):
        debugPrint("Chat screen creation failed with error: \(error)")
        return nil
      }
    }


