The theming system is identical between V5 and V6. All theme classes, properties, and APIs work the same way.
Theming Overview
Theming in the UI Kit consists of three core components:- Color: Managed through
CometChatColorPalette, it controls the application’s color scheme, including primary, neutral, alert, and text colors. - Typography: Defined via
CometChatTypography, it standardizes text styles, such as font size and weight. - Shape: Configured using
CometChatSpacing, it defines the structure of margins, paddings, and border radii.
Key Benefits
- Achieve consistent UI design across your application.
- Support for light and dark themes.
- Easy scalability and customization for app-specific requirements.
Light and Dark Themes
The Chat UI Kit supports both light and dark themes. V6 adds dedicated icon variants:assets/icons/light/— light mode iconsassets/icons/dark/— dark mode iconsassets/icons/svg/calls/— SVG call icons
Custom Theme
The Chat UI Kit offers robust support for creating customized themes usingCometChatColorPalette, CometChatTypography, and CometChatSpacing with Flutter’s ThemeExtension.
- Dart
Core Components
Color
TheCometChatColorPalette class manages colors in your app:
- Primary Colors: Base colors and extended shades.
- Neutral Colors: Shades for surfaces and backgrounds.
- Alert Colors: Colors for states like success, error, warning, and info.
- Text Colors: Differentiated for primary, secondary, and disabled states.
Typography
TheCometChatTypography class standardizes text styles:
- Headings: Text styles for various heading levels.
- Body: Styling for regular text.
- Captions: Smaller text style for labels.
- Buttons: Text style for button text.
- Links: Styles for clickable links.
- Titles: Style for main titles or component headers.
Spacing
TheCometChatSpacing class defines layout structure:
- Padding: Internal spacing within elements.
- Margin: Space between elements.
- Radius: Corner rounding of UI elements.
Best Practices
- Ensure Contrast: Follow accessibility guidelines to maintain a minimum contrast ratio.
- Consistency: Use a consistent color palette across all components.
- Adaptability: Test your theme in various scenarios, such as low-light and high-contrast environments.