cometchat-android-v5-theming

$npx mdskill add cometchat/cometchat-skills/cometchat-android-v5-theming

Customizes CometChat Android UI to match your app's design system

  • Identifies and changes CometChat colors to align with your brand.
  • Uses XML theme attributes and the `CometChatTheme` class for customization.
  • Applies per-component style resources to fine-tune appearance.
  • Enables dark mode and supports color system adjustments.

SKILL.md

.github/skills/cometchat-android-v5-themingView on GitHub ↗
---
name: cometchat-android-v5-theming
description: "Customize CometChat UI to match your app's design system. Covers CometChatTheme, XML attributes, style classes, dark mode, and color system."
license: "MIT"
compatibility: "Android 7.0+; Java 8+; Kotlin 1.8+; com.cometchat:chat-uikit-android:5.x"
metadata:
  author: "CometChat"
  version: "3.0.0"
  tags: "cometchat android theming customization branding dark-mode colors styles"
---

> **Ground truth:** `com.cometchat:chat-uikit-android:5.x` (legacy/maintenance-only; +`calls-sdk-android:5.x`) — resolved AAR (javap) + `ui-kit/android`. **Official docs:** https://www.cometchat.com/docs/ui-kit/android/overview · **Docs MCP:** `claude mcp add --transport http cometchat-docs https://www.cometchat.com/docs/mcp` (or fetch the URL directly without MCP). Verify symbols against the installed package/source before relying on them.

> **Companion skills:** `cometchat-android-v5-core` covers initialization;
> `cometchat-android-v5-components` provides the component catalog;
> `cometchat-android-v5-customization` covers deeper component-level overrides.

## Purpose

This skill teaches how to theme CometChat Android UI Kit v5 to match your app's design system. CometChat uses a combination of XML theme attributes, the `CometChatTheme` static class, and per-component style resources.

---

## Use this skill when

- Changing CometChat colors to match brand
- Customizing fonts or typography
- Enabling dark mode
- Applying per-component styles
- "How do I change the primary color?"
- "How do I make CometChat match my app theme?"

## Do not use this skill when

- Writing custom message templates → use `cometchat-android-v5-customization`
- Adding features → use `cometchat-android-v5-features`

---

## 1. How CometChat theming works

CometChat's visual identity is driven by XML theme attributes defined in `attrs.xml` files. Every `CometChat*` component reads these attributes from the current theme. To override: define the attributes in your app's theme.

### The CometChatTheme class

`CometChatTheme` is a static utility class that provides programmatic access to theme colors. It reads from XML theme attributes and supports runtime overrides.

**Key static methods:**

| Method | Description |
|---|---|
| `setPrimaryColor(int)` | Override primary color at runtime |
| `getPrimaryColor(Context)` | Get current primary color |
| `getExtendedPrimaryColor50(Context)` through `getExtendedPrimaryColor900(Context)` | Get extended primary color shades (auto-generated from primary) |
| `getBackgroundColor1(Context)` | Primary background color |
| `getTextColorPrimary(Context)` | Primary text color |
| `getTextColorSecondary(Context)` | Secondary text color |
| `getIconTintHighlight(Context)` | Highlighted icon tint |
| `getIconTintSecondary(Context)` | Secondary icon tint |

### Setting primary color programmatically

**Java:**
```java
CometChatTheme.setPrimaryColor(Color.parseColor("#6C63FF"));
```

**Kotlin:**
```kotlin
CometChatTheme.setPrimaryColor(Color.parseColor("#6C63FF"))
```

This must be called before any CometChat component is inflated. The extended color shades (50–900) are auto-generated by blending the primary color with white (light mode) or black (dark mode).

---

## 2. XML theme attributes

Override CometChat colors in your app's `themes.xml`:

```xml
<style name="AppTheme" parent="CometChatTheme.DayNight">
    <!-- CometChat primary color -->
    <item name="cometchatPrimaryColor">#6C63FF</item>

    <!-- Background colors -->
    <item name="cometchatBackgroundColor1">#FFFFFF</item>
    <item name="cometchatBackgroundColor2">#F5F5F5</item>

    <!-- Text colors -->
    <item name="cometchatTextColorPrimary">#141414</item>
    <item name="cometchatTextColorSecondary">#727272</item>

    <!-- Extended primary shades (optional — auto-generated if not set) -->
    <item name="cometchatExtendedPrimaryColor50">#F0EEFF</item>
    <item name="cometchatExtendedPrimaryColor100">#D9D5FF</item>
</style>
```

---

## 3. Per-component styles

Each component has its own style attribute that can be overridden in your theme. The naming convention is `cometchat<ComponentName>Style`.

| Component | Style attribute | Example |
|---|---|---|
| `CometChatConversations` | `cometchatConversationsStyle` | `@style/CustomConversationsStyle` |
| `CometChatMessageList` | `cometchatMessageListStyle` | `@style/CustomMessageListStyle` |
| `CometChatMessageComposer` | `cometchatMessageComposerStyle` | `@style/CustomComposerStyle` |
| `CometChatMessageHeader` | `cometchatMessageHeaderStyle` | `@style/CustomHeaderStyle` |
| `CometChatUsers` | `cometchatUsersStyle` | `@style/CustomUsersStyle` |
| `CometChatGroups` | `cometchatGroupsStyle` | `@style/CustomGroupsStyle` |
| `CometChatAvatar` | `cometchatAvatarStyle` | `@style/CustomAvatarStyle` |
| `CometChatBadge` | `cometchatBadgeStyle` | `@style/CustomBadgeStyle` |
| `CometChatStatusIndicator` | `cometchatStatusIndicatorStyle` | `@style/CustomStatusStyle` |
| `CometChatMessageReceipt` | `cometchatMessageReceiptStyle` | `@style/CustomReceiptStyle` |

---

## 4. Programmatic styling

Every component exposes setter methods for colors, text appearances, and drawables:

**Java:**
```java
CometChatConversations conversations = findViewById(R.id.conversations);
conversations.setBackgroundColor(Color.WHITE);
conversations.setTitleTextColor(Color.BLACK);
conversations.setTitleTextAppearance(R.style.MyTitleStyle);
conversations.setSeparatorColor(Color.LTGRAY);
conversations.setAvatarStyle(R.style.MyAvatarStyle);
conversations.setStatusIndicatorStyle(R.style.MyStatusStyle);
```

---

## 5. Dark mode

CometChat respects Android's `DayNight` theme. Define separate values in `values-night/themes.xml`:

```xml
<!-- values/themes.xml (light) -->
<style name="AppTheme" parent="CometChatTheme.DayNight">
    <item name="cometchatPrimaryColor">#6C63FF</item>
    <item name="cometchatBackgroundColor1">#FFFFFF</item>
    <item name="cometchatTextColorPrimary">#141414</item>
</style>

<!-- values-night/themes.xml (dark) -->
<style name="AppTheme" parent="CometChatTheme.DayNight">
    <item name="cometchatPrimaryColor">#7B73FF</item>
    <item name="cometchatBackgroundColor1">#1A1A2E</item>
    <item name="cometchatTextColorPrimary">#E0E0E0</item>
</style>
```

The `CometChatTheme` class auto-detects the current night mode and adjusts extended color shades accordingly.

---

## Hard rules

- **Set primary color BEFORE inflating components.** `CometChatTheme.setPrimaryColor()` must be called before `setContentView()` or component inflation.
- **Use XML theme attributes for global overrides.** Per-component setters are for fine-tuning.
- **Extended primary shades are auto-generated.** Only override them if you need exact brand colors at each shade level.
- **Dark mode uses `values-night/`.** Follow Android's standard `DayNight` theme pattern.

More from cometchat/cometchat-skills

SkillDescription
cometchatEntry-point for CometChat integration in any React, React Native, Angular, Android, Flutter, or iOS project — web (React/Next.js/React Router/Astro), React Native (Expo/bare), Angular (12-15), native Android (V6 stable, V5 legacy), Flutter (V6 stable, V5 legacy), and native iOS (V5 stable). Detects the framework, gathers requirements through an interactive conversation, and writes production-quality integration code.
cometchat-a11yAccessibility (a11y) for CometChat UI Kit integrations across all families — React, React Native, Angular, Android (V5/V6), iOS, Flutter. Covers WCAG 2.1 AA targets, keyboard navigation in chat, screen reader announcements (live regions for new messages), color contrast, focus management on call screens, motion-reduction support, and the cross-family checks that catch the common production a11y bugs. Cross-family — applies wherever the agent is checking accessibility.
cometchat-android-v5Entry-point dispatcher for CometChat Android UI Kit v5. Detects project setup, understands what the dev is building, and routes to the right sub-skills.
cometchat-android-v5-callsCometChat Calls SDK v5 integration for native Android (V5 stable, Java + Kotlin Views). Covers SDK setup (Cloudsmith Maven, CallAppSettings, init), the dual-SDK ringing pattern (Chat SDK initiateCall + Calls SDK joinSession), session settings, event listeners, call logs, recording, screen sharing, picture-in-picture, foreground service for ongoing calls, VoIP push via FCM + ConnectionService, audio/video/participant controls, custom UI, and in-call chat. Use in standalone mode (calls is the product) or additive mode (calls layered on top of an existing CometChat Android v5 chat integration).
cometchat-android-v5-componentsComplete catalog of CometChat Android UI Kit v5 components. Reference before writing integration code — never invent component names.
cometchat-android-v5-coreFoundational rules for CometChat Android UI Kit v5. Initialization, login, UIKitSettings builder, dependency setup, and anti-patterns. Read this first.
cometchat-android-v5-customizationCustomize CometChat components beyond theming — custom message templates, DataSource decorators, event listeners, and custom view slots.
cometchat-android-v5-extensionsExtension architecture for CometChat Android — ExtensionsDataSource, decorators, built-in extensions, and how to create custom extensions.
cometchat-android-v5-featuresAdd features (calls, reactions, polls, file sharing, AI, etc.) to an already-integrated CometChat project. Routes to the right sub-flow based on feature type.
cometchat-android-v5-placementWhere to put CometChat in your Android app — Activity, Fragment, BottomSheet, Dialog, Tab, or embedded patterns.