NowUIColoring을 사용하여 NowWebTheme 및 NowChatTheme 테마 지정

  • 릴리스 버전: Australia
  • 업데이트 날짜 2026년 03월 12일
  • 소요 시간: 3분
  • NowUIColoring 인터페이스에는 모든 NowSDK 모듈에서 사용하는 모든 색상이 포함되어 있습니다.

    여러 SDK 모듈에서 유사한 색 변수를 사용하는 시나리오의 경우 NowUIColoring 인터페이스를 구현할 수 있습니다. 이 인터페이스를 사용하면 색 값을 재정의한 다음 해당 구현을 사용하여 테마 클래스 NowWebThemeNowChatTheme 내의 nowUIColoring 값을 재정의할 수 있습니다. 색상 변수가 재정의되지 않은 경우 NowUIColoring 인터페이스는 기본 색상을 사용합니다.

    다음 코드 예제에서는 웹 UI와 채팅 UI 모두의 색을 재정의하는 방법을 보여 줍니다.

    // Implement the NowUIColoring and override desired color variables
    val nowUIColoringImpl = object : NowUIColoring {
        override val brand: Int
            get() = Color.BLUE
    
        override val textPrimary: Int
            get() = Color.WHITE
    
        //override the rest of color variables
    
    }
    
    // Override the nowUIColoring for NowWeb value using the NowUIColoring implementation
    lifecycleScope.launch {
        sdkManager.getNowWebService()?.launch(activity, URL("https://instance-name.service-now.com"), object : NowWebTheme {
            override val nowUIColoring: NowUIColoring
                get() = nowUIColoringImpl
        })
    }
    
    //Override the nowUIColoring for NowChat value using the NowUIColoring implementation
    lifecycleScope.launch {
        sdkManager.getNowChatService()?.start(activity, object : NowChatTheme {
            override val nowUIColoring: NowUIColoring
                get() = nowUIColoringImpl
        })
    }

    어두운 테마 지원

    NowChat에서 어두운 테마를 지원하려면 NowChatTheme의 고유한 어두운 테마 구현을 제공하여 NowChatService.start()NowChatService.updateTheme() 함수에서 사용할 수 있습니다. 또는 기본 어두운 테마 색으로 NowChatTheme 인터페이스를 구현하는 NowChatThemeDark 클래스를 사용할 수 있습니다. 이 클래스를 사용자 지정 어두운 테마 구현의 기반으로 사용할 수도 있습니다.

    val chatService = serviceManager.getNowChatService()
    
    val chatThemeLight = object : NowChatTheme {
        override val backgroundPrimary: Int
            get() = Color.WHITE
    
        override val textPrimary: Int
            get() = Color.BLACK
    
        // Override remaining theme colors
    }
    
    //create dark theme using the NowChatThemeDark class
    val chatThemeDark = object : NowChatThemeDark(){
        override val backgroundPrimary: Int
            get() = Color.BLACK
    
        override val textPrimary: Int
            get() = Color.WHITE
    
        // Override remaining theme colors
    }
    
    //start NowChat with light theme
    chatService?.start(activity, chatThemeLight)
    
    
    //update NowChat theme to dark theme
    chatService?.updateTheme(chatThemeDark)