
You then need to pass the new custom theme to the Theme function, for example ChannelListTheme, using the Android native helper called CompositionLocalProvider. To customize the look of a component, create a custom theme for the component in which you override one or a few default parameters specified for the component in the ThemeDefaults.kt file. Now that you know how these component and element themes work in PubNub Chat Components for Android, see how you can override the default values they provide in your app.Ĭustomization allows you to change such parameters as the position on the screen (through modifiers), colors, text sizes, and icons. In this example, it specifies that the typingIndicator must use TextThemeDefaults with fontSize of 12.sp and Material Theme onSurface color at 54% opacity.Īll in-house PubNub themes for components and common elements have a unified naming convention and end with the Theme suffix, like TextTheme. Text, similarly to icon, references and overrides our in-house default theme. In this example, the typingIndicator function uses the IconThemeDefaults theme for the icon but overrides the importance hierarchy of the Material Theme primary color for the tint to medium using the ContentAlpha object from Jetpack Compose. See all of them defined in the common folder. Apart from default themes for components, we also provide the default themes for common objects used across multiple components, such as buttons, icons, shapes, or texts. Icon references IconTheme and overrides the IconThemeDefaults theme for an icon. In this example, the typingIndicator function uses the Compose modifier to set the maximum width of the typing indicator and change the padding to 12 dp. Each theme for a given PubNub Chat Component for Android contains a modifier and allows you to customize the component to your needs.

Modifier which is a native Compose object that allows you to decorate your composable function and change its layout, behavior, and appearance by changing the given element's padding, width, or hight.
