cometchat-native-theming
CometChatThemeProvider + CometChatI18nProvider — color tokens, typography, dark mode, per-component style overrides, and localization (18 built-in languages + custom translations). The JS theme object replaces CSS variables.
cometchat · AI review on file
Installation
Read the source and dependencies before running a command. Copying does not install or execute anything.
npx skills add cometchat/cometchat-skills --skill cometchat-native-themingAbout this skill
name: cometchat-native-theming description: "CometChatThemeProvider + CometChatI18nProvider — color tokens, typography, dark mode, per-component style overrides, and localization (18 built-in languages + custom translations). The JS theme object replaces CSS variables." license: "MIT" compatibility: "Node.js >=18; React Native >=0.70; @cometchat/chat-uikit-react-native ^5" allowed-tools: "executeBash, readFile, fileSearch, listDirectory, AskUserQuestion" metadata: author: "CometChat" version: "3.0.0" tags: "cometchat react-native theming colors dark-mode typography"
Purpose
Teaches Claude how to theme and localize the React Native UI Kit via CometChatThemeProvider + CometChatI18nProvider. No CSS — React Native uses a JS theme object instead. This skill covers color tokens, typography, light/dark modes, per-component style overrides, the useTheme() hook for custom views, and localization (18 built-in languages, device auto-detect, custom translation overrides) via useCometChatTranslation().
Read cometchat-native-core first (the wrapper chain that includes CometChatThemeProvider) before this skill. cometchat-native-components § 13 covers per-component style={} overrides, which are a sibling concern to theming.
Ground truth: docs/ui-kit/react-native/theme.mdx, colors.mdx, component-styling.mdx, message-bubble-styling.mdx, and packages/ChatUiKit/src/theme/type.ts (the canonical type definitions).
1. How theming works (no CSS — JS theme object)
React Native has no CSS. Instead:
CometChatThemeProvider
↓ (provides theme via React Context)
every <CometChat*> component reads theme via internal useTheme()
↓
component's default styles merge with theme overrides → rendered styles
The theme object you pass has two top-level keys for light/dark variants:
<CometChatThemeProvider
theme={{
mode: "light", // or "dark", or omit for OS-default
light: { color: { primary: "#F76808" } },
dark: { color: { primary: "#FF8A3D" } },
}}
>
<App />
</CometChatThemeProvider>
Style precedence (highest to lowest)
- Component
style={}prop — wins always. Per-component tweak, overrides everything. - Custom theme via
CometChatThemeProvider— app-wide. - Default theme — the UI Kit's built-in palette.
So for a one-off color on a single component, use style={}. For a brand-wide change (primary color everywhere), use the theme.
Deep merge
Theme values are deeply merged with defaults — you only specify what you want to change:
theme={{
light: {
color: {
primary: "#F76808", // override just primary; everything else keeps defaults
},
typography: {
heading1: { fontWeight: "700" }, // override just heading1 weight
},
},
}}
2. The CometChatThemeProvider
Minimum setup — follow system light/dark
import { CometChatThemeProvider } from "@cometchat/chat-uikit-react-native";
<CometChatThemeProvider>
{/* children read the current system mode automatically */}
</CometChatThemeProvider>
Force a mode
<CometChatThemeProvider theme={{ mode: "light" }}>{/* ... */}</CometChatThemeProvider>
<CometChatThemeProvider theme={{ mode: "dark" }}>{/* ... */}</CometChatThemeProvider>
Placement in the wrapper chain
CometChatThemeProvider is one of the four required wrappers — goes right above CometChatProvider, below SafeAreaProvider (see cometchat-native-core § 3):
<GestureHandlerRootView style={{ flex: 1 }}>
<SafeAreaProvider>
<CometChatThemeProvider theme={/* your theme */}>
<CometChatProvider appId={...} region={...} authKey={...}>
<YourApp />
</CometChatProvider>
</CometChatThemeProvider>
</SafeAreaProvider>
</GestureHandlerRootView>
Without CometChatThemeProvider, components throw or fall back to minimal styles. Even if you don't customize anything, the wrapper is mandatory.
3. Color tokens
Every color is a hex string ("#F76808" — never "rgb(...)" or named colors).
Primary (brand accent)
| Token | Controls |
|---|---|
primary | Outgoing message bubbles, send button, active tabs, buttons |
extendedPrimary50–900 | Auto-derived shades of primary. Used for hover, pressed, subtle accents. Only override these if you need finer control — the auto-derivation is usually correct. |
Neutrals (surfaces + borders)
| Token | Default (light) | Controls |
|---|---|---|
neutral50 | #FFFFFF | White/light surface, background1 default |
neutral100 | #FAFAFA | background2 default |
neutral200 | #F5F5F5 | background3 default |
neutral300 | #E8E8E8 | Incoming bubble default, borders |
neutral400 | #DCDCDC | Divider lines |
neutral500 | #A1A1A1 | Placeholder / muted text, iconSecondary default |
neutral600 | #727272 | textSecondary (timestamps, subtitles) |
neutral700 | #5B5B5B | Body text tier 3 |
neutral800 | #434343 | Headings default |
neutral900 | #141414 | textPrimary default, iconPrimary default |
Background aliases
| Token | Maps to (default) | Controls |
|---|---|---|
background1 | neutral50 | Main app background |
background2 | neutral100 | Sidebars, panels |
background3 | neutral200 | Nested panels, cards |
background4 | neutral300 | Additional surface |
Text
| Token | Default | Controls |
|---|---|---|
textPrimary | neutral900 | Main body text |
textSecondary | neutral600 | Timestamps, subtitles |
textTertiary | neutral500 | Hints, placeholders |
textHighlight | primary | Links, mentions |
Icon
| Token | Default | Controls |
|---|---|---|
iconPrimary | neutral900 | Active / default icons |
iconSecondary | neutral500 | Inactive icons |
iconHighlight | primary | Action icons |
Semantic (state indicators)
| Token | Default (light) | Controls |
|---|---|---|
info | #0B7BEA | Info |