ChatTheme

fun ChatTheme(isInDarkMode: Boolean = isSystemInDarkTheme(), config: ChatUiConfig = ChatUiConfig(), colors: StreamDesign.Colors = if (isInDarkMode) { StreamDesign.Colors.defaultDark() } else { StreamDesign.Colors.default() }, typography: StreamDesign.Typography = StreamDesign.Typography.default(), componentFactory: ChatComponentFactory = DefaultChatComponentFactory(), attachmentPreviewHandlers: List<AttachmentPreviewHandler> = AttachmentPreviewHandler.defaultAttachmentHandlers(LocalContext.current), reactionResolver: ReactionResolver = ReactionResolver.defaultResolver(), messagePreviewIconFactory: MessagePreviewIconFactory = MessagePreviewIconFactory.defaultFactory(), dateFormatter: DateFormatter = DateFormatter.from(LocalContext.current), timeProvider: TimeProvider = TimeProvider.DEFAULT, durationFormatter: DurationFormatter = DurationFormatter.defaultFormatter(), channelNameFormatter: ChannelNameFormatter = ChannelNameFormatter.defaultFormatter(LocalContext.current), messagePreviewFormatter: MessagePreviewFormatter = MessagePreviewFormatter.defaultFormatter( context = LocalContext.current, typography = typography, autoTranslationEnabled = config.translation.enabled, ), searchResultNameFormatter: SearchResultNameFormatter = SearchResultNameFormatter.defaultFormatter(), imageLoaderFactory: StreamCoilImageLoaderFactory = StreamCoilImageLoaderFactory.defaultFactory(), messageAlignmentProvider: MessageAlignmentProvider = MessageAlignmentProvider.defaultMessageAlignmentProvider(), streamCdnImageResizing: StreamCdnImageResizing = StreamCdnImageResizing.defaultStreamCdnImageResizing(), messageTextFormatter: MessageTextFormatter = MessageTextFormatter.defaultFormatter( autoTranslationEnabled = config.translation.enabled, typography = typography, colors = colors, ), streamMediaRecorder: StreamMediaRecorder = DefaultStreamMediaRecorder(LocalContext.current), content: @Composable () -> Unit)

Our theme that provides all the important properties for styling to the user.

Parameters

isInDarkMode

If we're currently in the dark mode or not. Affects only the default color palette that's provided. If you customize colors, make sure to add your own logic for dark/light colors.

config

Central behavioral configuration for the Chat SDK. See ChatUiConfig.

colors

The set of colors we provide, wrapped in StreamDesign.Colors.

typography

The set of typography styles we provide, wrapped in StreamDesign.Typography.

componentFactory

Provide to customize the stateless components that are used throughout the UI.

attachmentPreviewHandlers

Attachment preview handlers we provide.

reactionResolver

Provides available reactions and resolves reaction types to emoji codes.

messagePreviewIconFactory

Used to create a preview icon for the given message type.

dateFormatter

DateFormatter Used throughout the app for date and time information.

timeProvider

TimeProvider Used throughout the app for time information.

durationFormatter

DurationFormatter Used to format durations in the app.

channelNameFormatter

ChannelNameFormatter Used throughout the app for channel names.

messagePreviewFormatter

MessagePreviewFormatter Used to generate a string preview for the given message.

searchResultNameFormatter

SearchResultNameFormatter Used to format names in search results.

imageLoaderFactory

A factory that creates new Coil ImageLoader instances. If you provide a custom factory and use a custom CDN (via io.getstream.chat.android.client.ChatClient.Builder), you must override the StreamCoilImageLoaderFactory.imageLoader overload that accepts interceptors; otherwise those features are silently ignored. If you don't use a custom CDN, overriding the single-arg method is sufficient.

messageAlignmentProvider

MessageAlignmentProvider Used to provide message alignment for the given message.

streamCdnImageResizing

Sets the strategy for resizing images hosted on Stream's CDN. Disabled by default, set StreamCdnImageResizing.imageResizingEnabled to true if you wish to enable resizing images. Note that resizing applies only to images hosted on Stream's CDN which contain the original height (oh) and width (ow) query parameters.

messageTextFormatter

MessageTextFormatter Used to format message text for display.

streamMediaRecorder

Used for recording audio messages.

content

The content shown within the theme wrapper.