Skip to main content

Theme

CometChatTheme class is made up of two primary components such as:

  1. Palette
  2. Typography

Palette

CometChatUIKit's palette is a predefined set of colors to provide a consistent and unified color scheme that can be used across various elements and components. It supports 2 specific color schemes i.e. light and dark

CometChatUIKit's palette primarily consists of four colors. It includes the background color, primary color, error color, accent color, and its variations of shades and tints.

ModeColor code
Light#FFFFFF
Dark#141414
ColorDescriptionColor code in light modeColor code in dark mode
backgroundThis is used as the background color for the main UI components.#FFFFFF#141414
primaryThis is used to highlight or emphasize elements.#3399FF#3399FF
errorThis color is used for the destructive components/actions in components across UI Kit#FF3B30#FF3B30
accentThis color is used as the background color to emphasize elements, but with less vibrance than the primary color#141414#FFFFFF
Accent colorsOpacity
accent504%
accent1008%
accent20015%
accent30024%
accent40033%
accent50046%
accent60058%
accent70069%
accent80082%
accent900100%
Primary colorsOpacity
primary15015%
primary50050%

Typography

CometChatUIKit's typography encompasses the font family, font size and other typographic elements. All fonts used in UI Kit are pre-configured with the below values, but you can also customize it.

NameDescriptionValue
Font familyThis accepts a prioritized list of one or more font family names and/or generic family names for the selected elementInter
NameValue
fontWeightRegular400
fontWeightMedium500
fontWeightSemibold600
fontWeightBold700
TypographyFont familySizeWeight
HeadingInter22pxfontWeightBold
NameInter16pxfontWeightMedium
Title1Inter22pxfontWeightRegular
Title2Inter15pxfontWeightSemibold
Subtitle1Inter15pxfontWeightRegular
Subtitle2Inter13pxfontWeightRegular
Text1Inter17pxfontWeightRegular
Text2Inter15pxfontWeightMedium
Text3Inter13pxfontWeightMedium
Caption1Inter12pxfontWeightMedium
Caption2Inter11pxfontWeightMedium
Caption3Inter8pxfontWeightRegular

Usage

Step1: Provide theme to App

import { createApp } from "vue"; import App from "./App.vue"; const app =
createApp(App); //App level provider makes the provided value available across
the application via inject app.provide("theme", new CometChatTheme({}));
app.mount("#app");

Step2: Injecting and using the Theme within the component

info

App level providers to make it available in the entire application Component level providers to make it available in child components

<script lang="ts">
import { defineComponent, inject, provide } from "vue";

export default defineComponent({
setup() {
//Inject the Theme in the component to be used
//A default value can be provided as a fallback while injecting
let injectedTheme = inject("theme", DefaultThemeObject);

//using the theme
let defaultStyle: CallButtonsStyle = new CallButtonsStyle({
voiceCallIconTint: injectedTheme.palette.getPrimary(),
videoCallIconTint: injectedTheme.palette.getPrimary(),
voiceCallIconTextColor: injectedTheme.palette.getPrimary(),
videoCallIconTextColor: injectedTheme.palette.getPrimary(),
});

return {};
},
});
</script>

Theme can also be provided within a component but this will only be available to be injected in the child components

<script lang="ts">
import { CometChatTheme } from "uikit-resources-lerna";
import { defineComponent, provide } from "vue";

export default defineComponent({
setup() {
//Make the theme available to child components by providing it in a parent component
provide("theme", new CometChatTheme({}));

return {};
},
});
</script>