Skip to main content

Overview

The Theme is a style applied to every component of CometChat. When a style is applied as a theme, every view in the activity or every component in the UiKit will apply each property of the theme that it supports. CometChat theme comprises two key components: Palette and Typography. Palette: The Palette is a class that possesses all the color variables with their default values. It can be used to customize the color scheme of the CometChat theme, including background color, primary and secondary colors, error color, and various levels of accent colors. Typography: Typography, which is also a singleton class, encompasses all the default Text Style’s values. It allows you to customize the text appearances throughout the CometChat theme, such as heading, name, titles, subtitles, text, and captions.

Usage

Palette

The CometChat UI kit provides an easy way to customize the visual appearance of your chat application via the Palette class. This class contains several methods that allow you to modify the default color scheme of your app, imparting a unique look and feel that aligns with your branding or design guidelines. Here’s an overview of the different color’s available in the Palette class: Here’s an overview of the different methods available in the Palette class: Example
To modify the palette user has to firstly create an instance of palette.
After creating a instance user can update the values of colors as shown below:
Switching between Light and Dark modes in CometChat is quite simple by manipulating the mode property of the Palette class.
By default, UI Kit will be support in both light and dark mode. > > If you wish to set the whole app always in the dark mode then you can set it in the application class such as AppDelegate or SceneDelegate using below code snippet.> > window?.overrideUserInterfaceStyle = .dark

Typography

The Typography class provides methods that allow you to change the default text styles in the CometChat theme as per your requirements. User can set custom font as well using Typography class. Here are some of the methods provided by the Typography class: To change Name TextStyle of the UiKit Theme Please refer to the code below :
  • To modify the palette user has to firstly create an instance of Typography.
  • After creating a instance user can update the values of fonts as shown below:
  • User can also update the font family using below snippet.
After creation of both Palette and typography class, user can initialize the theme class.
If user wish to set the default appearance then you can use below method.
At the end your application class will look like this:
similarly to change other Text Style of Theme you can refer to the above mentioned method.