Skip to main content
The UI Kit supports multiple approaches to styling depending on your module.

Styling Approaches

Two ways to style components:
  1. XML theme attributes — declarative, app-wide theming via themes.xml
  2. Programmatic CometChatTheme setters — runtime color/font overrides
Programmatic setters take precedence over XML theme attributes.

XML Theme Hierarchy

themes.xml
<!-- Level 1: Theme-level colors and fonts -->
<style name="AppTheme" parent="CometChatTheme.DayNight">
    <item name="cometchatPrimaryColor">#6851D6</item>
    <item name="cometchatBackgroundColor1">#FFFFFF</item>
    <item name="cometchatFontRegular">@font/my_regular_font</item>
    <item name="cometchatFontMedium">@font/my_medium_font</item>
    <item name="cometchatFontBold">@font/my_bold_font</item>

    <!-- Level 2: Component-level style -->
    <item name="cometchatConversationsStyle">@style/CustomConversationsStyle</item>
</style>

<!-- Level 2: Component style with nested sub-component styles -->
<style name="CustomConversationsStyle" parent="CometChatConversationsStyle">
    <item name="cometchatConversationsAvatarStyle">@style/CustomAvatarStyle</item>
    <item name="cometchatConversationsBadgeStyle">@style/CustomBadgeStyle</item>
</style>

<!-- Level 3: Sub-component style -->
<style name="CustomAvatarStyle" parent="CometChatAvatarStyle">
    <item name="cometchatAvatarStrokeRadius">12dp</item>
    <item name="cometchatAvatarBackgroundColor">#E8E0FF</item>
</style>

Programmatic Overrides

// Override theme colors at runtime
CometChatTheme.setPrimaryColor(Color.parseColor("#6851D6"))
CometChatTheme.setBackgroundColor1(Color.parseColor("#FFFFFF"))
CometChatTheme.setTextColorPrimary(Color.parseColor("#141414"))
CometChatTheme.setTextColorSecondary(Color.parseColor("#727272"))

Font Customization

Override fonts at the theme level:
themes.xml
<style name="AppTheme" parent="CometChatTheme.DayNight">
    <item name="cometchatFontBold">@font/my_bold_font</item>
    <item name="cometchatFontMedium">@font/my_medium_font</item>
    <item name="cometchatFontRegular">@font/my_regular_font</item>
</style>
AttributeUsage
cometchatFontBoldHeadings, titles, emphasized text
cometchatFontMediumSubtitles, secondary headings
cometchatFontRegularBody text, descriptions, input fields

CometChatTheme Color Tokens

These tokens are available for programmatic override (Kotlin XML) or via CometChatColorScheme (Compose):

Colors

TokenDescription
primaryColorBrand color for buttons, links, highlights
backgroundColor1backgroundColor4Background levels
textColorPrimary / Secondary / TertiaryText colors
textColorDisabled / White / HighlightSpecial text colors
errorColor / successColor / warningColor / infoColorAlert colors
strokeColorDefault / Light / Dark / HighlightBorder colors

Icon Tints

TokenDescription
iconTintPrimary / Secondary / TertiaryIcon tints
iconTintWhite / HighlightSpecial icon tints

Button Colors

TokenDescription
primaryButtonBackgroundColor / TextColor / IconTintPrimary button
secondaryButtonBackgroundColor / TextColor / IconTintSecondary button

Per-Component Style Properties

Each component has its own style data class with nested sub-component styles. Here’s the pattern for key components:

CometChatConversations

PropertyDescription
backgroundColorList background
titleTextColorToolbar title color
searchBoxStyleSearch box styling
itemStyle.avatarStyleAvatar in each row
itemStyle.badgeStyleUnread badge
itemStyle.dateStyleTimestamp
itemStyle.receiptStyleRead receipts
itemStyle.statusIndicatorStyleOnline/offline indicator
itemStyle.typingIndicatorStyleTyping indicator

CometChatMessageList

PropertyDescription
backgroundColorList background
incomingMessageBubbleStyleIncoming bubble appearance
outgoingMessageBubbleStyleOutgoing bubble appearance
actionBubbleStyleGroup action bubbles
callActionBubbleStyleCall action bubbles

CometChatMessageComposer

PropertyDescription
backgroundColorComposer background
attachmentIconTintAttachment button tint
voiceRecordingIconTintVoice recording button tint
aiIconTintAI button tint
sendButtonStyleSend button appearance

CometChatMessageHeader

PropertyDescription
backgroundColorHeader background
titleTextColorUser/group name color
subtitleTextColorStatus/typing text color
avatarStyleAvatar appearance
callButtonsStyleCall button appearance