Style your SDK
Diyalog SDK provides custom Diyalog style to your application, using Diyalog style customer can create own styled screen.
How to use custom style?#
First create object of DiyalogStyle class from your application class, and using that object you can access all property of DiyaLogStyle class.
- Diyalog style is optional. If customer don't wants to use custom style then SDK will use default style
Sample code:#
More options?#
Followings are styles parameters with the help of those parameters User can configure style within their Application:
1. General#
- To set Application main theme color(Theme color)
- style.setMainColor(Color.parseColor("#f442d4"));
- Default color theme in SDK - "#4d74a6"
- This color is used for text and icon in an Application, if user not set any other style parameter then SDK will use theme color as a base.

- To set custom background image in chat(conversation) screen
- style.setDefaultBackgrouds(new int[]{im.diyalog.sdk.R.drawable.intro_background, R.drawable.img_chat_background_default, R.drawable.bg_1, R.drawable.bg_2});
- Customer can use multiple images
- If customer set background by using setDefaultBackground method then user can see all background images in Setting screen, by default SDK will set first image as background but customer can change from list of background from setting screen.

- To set toolbar(Header) background color
- style.setToolBarColor(R.color.picker_main_color);
- By default SDK will set the color which user has defined in setMainColor method.
- To set floating button background color based on User action as mentioned below.
- Normal
- style.setFabColor(Color.parseColor("#77a358"));
- Customer can customize normal fab background color
- Diyalog SDK change all fab background color
- Pressed
- style.setFabPressedColor(Color.parseColor("#a27e57"));
- Diyalog SDK change all pressed fab background color.
- Normal
- To set screen background color when options are visible to user on click of floating button.
- style.setMainFabbgColor(Color.parseColor("#33dd0d1e"));
- When click on fab icon show sub items, SDK will change background color for subitems.

- To set application background color in all screen
- style.setMainBackgroundColor(Color.parseColor("#bcc6b8"));

- style.setMainBackgroundColor(Color.parseColor("#bcc6b8"));
- To set place holder background color for user cover avtar Image
- style.setAvatarBackgroundColor(Color.parseColor("#139dea"));
- To set place holder background image for user cover avtar Image
- style.setAvatarBackgroundResource(R.drawable.bg_1);
- Note: If you set both color and image resource for user placeholder then SDK will accept avatar image resource as a place holder
2. Customise toolbar#
Diyalog SDK provides custom Toolbar style to your application, using this customise you can set toolbar and statusbar same as your main application.
How to use custom toolbar?#
First create object of DiyalogStyle class from your application class, and using that object you can customise toolbar.
Sample code:#
Following are cases in which Client can customise toolbar in sdk:
- Set gradient background for toolbar and statusbar
style.setGradientToolbar(R.drawable.gradient_bg);
Client need to create gradient drawable file into main application, and need to pass this file refrence as a configurable parameter.
- Set background color for toolbar and statusbar
style.setMainColor(Color.parseColor("#139dea"));
By default Main color of application theme will set as a toolbar & statusbar color
style.setStatusBarColor(Color.parseColor("#e00b52"));
This will change only statusbar color of sdk.
style.setToolBarColor(R.color.picker_main_color);
This will change only toolbar color of sdk.
Note: If you will set gradient background configuration then above configuration will not be apply effact.
3. Setting#
To set setting screen label and text color
- style.setSettingsCategoryTextColor(Color.parseColor("#f28e02"));
- By default SDK will set the color which user has defined in setMainColor method.
To set setting screen icon color
- style.setSettingsIconColor(Color.parseColor("#e00b52"));
To set setting screen title color
- style.setSettingsTitleColor(Color.parseColor("#5622b7"));

- style.setSettingsTitleColor(Color.parseColor("#5622b7"));
4. Dividers#
- To set divider color to list in application
- style.setDividerColor(Color.parseColor("#e00b52"));
- This divider color will apply to whole application as divider color.
5. Text color#
- Set primary text color
- style.setTextPrimaryColor(Color.parseColor("#e00b52"));
- Set secondary color
- style.setTextSecondaryColor(Color.parseColor("#0a0ed8"));

- style.setTextSecondaryColor(Color.parseColor("#0a0ed8"));
- Set hint color
- style.setTextHintColor(Color.parseColor("#ede50e"));
- style.setTextHintColor(Color.parseColor("#ede50e"));
- Set sub header color
- style.setTextSubHeaderColor(Color.parseColor("#f49e42"));

- In above image see text color of label "Long press for additional options"
- style.setTextSubHeaderColor(Color.parseColor("#f49e42"));
6. Contact screen(contact tab of main screen)#
- set share icon and text color
- style.setActionShareColor(Color.parseColor("#0a0ed8"));
- By default SDK will set the color which user has defined in setMainColor method.
- set short name(First character) text color
- style.setContactFastTitleColor(Color.parseColor("#e00b52"));
- By default SDK will set the color which user has defined in setMainColor method.
- set Add contact icon and text color
- style.setActionAddContactColor(Color.parseColor("#0a0ed8"));
- By default SDK will set the color which user has defined in setMainColor method.
- set list divider color
- style.setContactDividerColor(Color.parseColor("#ede50e"));
- if customer has not set contact divider color then it will accept default divider color which user has set in “setDividerColor” method

7. Chat screen (Chat tab from home screen)#
- Set indicator color of sent message
- style.setDialogsStateSentColor(Color.parseColor("#0794ed"));
- Set indicator color of delivered message
- style.setDialogsStateDeliveredColor(Color.parseColor("#edd607"));
- Set indicator color of read message
- style.setDialogsStateReadColor(Color.parseColor("#edd607"));

- style.setDialogsStateReadColor(Color.parseColor("#edd607"));
- Set counter text color of unread message count
- style.setDialogsCounterTextColor(Color.parseColor("#f48004"));
- Set counter background color for unread message count
- style.setDialogsCounterBackgroundColor(Color.parseColor("#120be0"));

- style.setDialogsCounterBackgroundColor(Color.parseColor("#120be0"));
- Set text color for last conversation message time
- style.setDialogsTimeColor(Color.parseColor("#c62e0f"));
- set divider color between chat list
- style.setDialogsDividerColor(Color.parseColor("#e0120b"));
- By default SDK show default divider color
- Set text color for contact name
- style.setDialogsTitleColor(Color.parseColor("#4a8413"));
- By default SDK show primary color
- Set last message which is either sent or receive text color
- style.setDialogsTextColor(Color.parseColor("#a8a579"));
- By default SDK show main theme color
- Set typing label text color which indicates user is typing a message.
- style.setDialogsTypingColor(Color.parseColor("#40000000"));
- By default SDK show main theme color

- Set last message text color of content type media and document
- style.setDialogsActiveTextColor(Color.parseColor("#db2a0a"));

- style.setDialogsActiveTextColor(Color.parseColor("#db2a0a"));
8. Friends Profile/ Group profile#
- Set title color of friendName and groupName text color
- style.setProfileTitleColor(Color.parseColor("#139dea"));
- subtitle color (Last seen text color)
- style.setProfileSubtitleColor(Color.parseColor("#139dea"));
- contact icon color
- If not set then it will show default action icon color
- style.setProfileContactIconColor (Color.parseColor("#139dea"));
- To set action icon color(action icon like :- Add contact, new message, voice call)
- style.setListActionColor(Color.parseColor("#db2a0a"));
- By default SDK will set the color which user has defined in setMainColor method.
- Small icon color
- style.setSectonIconSmallColor(Color.parseColor("#0a0ed8"));
- By Default color for small icon is "# b5b6b7"

9. Group profile#
- Set admin label text color
- If not pass then set default Accent color
- style.setGroupAdminColor(Color.parseColor("#0cd341"));
- set online label text color into group profile screen for members list
- style.setGroupOnlineColor(Color.parseColor("#380249"));

- style.setGroupOnlineColor(Color.parseColor("#380249"));
10. Conversation(Chat Detail)#
- set enable send message icon color
- style.setConvSendEnabledColor(Color.parseColor("#0cd341"));
- Set disable send message icon color
- style.setConvSendDisabledColor(Color.parseColor("#db2a0a"));
- Set date text color
- style.setConvDatetextColor(Color.parseColor("#db0be2"));
- Set date text background color
- style.setConvDateBgColor(Color.parseColor("#18d8e2"));
- Set chat message color
- style.setConvTextColor(Color.parseColor("#db2a0a"));
- Set chat message date color
- style.setConvTimeColor(Color.parseColor("#0cd341"));
- Set sent message indicator color
- style.setConvStateSentColor(Color.parseColor("#40000000"));
- Set delivered message indicator color
- style.setConvStateDeliveredColor(Color.parseColor("#40000000"));
- Set read message indicator color
- style.setConvStateReadColor(Color.parseColor("#ff7ea8ef"));
- Set media chat message date icon color
- style.setConvMediaDateBgColor(Color.parseColor("#99000000"));
- Set pending media chat message indicator color
- style.setConvMediaStatePendingColor(Color.parseColor("#ffffff"));
- Set sent media chat message indicator color
- style.setConvMediaStateSentColor(Color.parseColor("#ffffff"));
- Set deliver media chat message indicator color
- style.setConvMediaStateDeliveredColor(Color.parseColor("#ffffff"));
- Set read media chat message indicator color
- style.setConvMediaStateReadColor(Color.parseColor("#ff7ea8ef"));
- Set favorite chat message icon color
- style.setConvLikeColor(Color.parseColor("#e2264d"));

- style.setConvLikeColor(Color.parseColor("#e2264d"));
11. OnlineHelp Screens#
set toolbar title color of chat and wait screens. This set all text of the onlinehelp and wait screens if they are not set indiviually.
- style.setOnlineHelpToolBarTitleColor(Color.parseColor("#0cd341"));
set toolbar background color of chat and wait screens.
- style.setOnlineHelpToolBarBackgroundColor(Color.parseColor("#0cd341"));
set toolbar bottom border line color of chat screen.
- style.setOnlineHelpChatToolbarBorderColor(Color.parseColor("#0cd341"));
set toolbar bottom border line color of wait screen.
- style.setOnlineHelpWaitToolbarBorderColor(Color.parseColor("#0cd341"));
set main background color of chat and wait screens.
- style.setOnlineHelpBackgroundColor(Color.parseColor("#0cd341"));
set color of text in chat and wait screens.
- style.setOnlineHelpTextColor(Color.parseColor("#0cd341"));
set back button image of chat and wait screens.
- style.setOnlineHelpBackIcon(R.mipmap.back_icon);
set title image of chat screen. If it is set, title text will not show. Instead, icon or image will be shown.
- style.setOnlineHelpToolBarTitleImage(R.drawable.brand_logo);
set agent avatar will be shown or not in the chat screen. Default is set as true. If you don't want to show it, you can set it to false.
- style.setShowOnlineHelpAgentAvatar(false);
set avatar image of agent in chat screen. If it is not set, default agent avatar will be shown.
- style.setOnlineHelpCustomAgentAvatarImg(R.mipmap.agent_avatar);
set built-in back arrow type of chat and wait screens. Options are
OnlineHelpBackArrowType.whiteandOnlineHelpBackArrowType.blue(default).- style.setOnlineHelpBackArrowType(DiyalogStyle.OnlineHelpBackArrowType.white);
set image shown on the wait screen when an error occurs.
- style.setOnlineHelpWaitOnErrorImage(R.drawable.wait_error);
Note: The custom chat app bar and input panel layouts (Custom Layouts) are not used on Online Help screens. Use the settings above for those screens.
Applying your style#
SDK version: The settings below are available from Diyalog Android SDK 5.14.1 (typography and custom layouts from 5.14.0). Artifact:
im.diyalog:DiyalogEngine. Requirements:minSdkVersion21 or higher, Java 17.
All style settings live on one object: DiyalogEngine.diyalogInstance().style, an instance of im.diyalog.sdk.DiyalogStyle. The SDK reads these values when it draws its screens. Apply your style in Application.onCreate(), before createDiyalog(...), so the first SDK screen the user opens already has your brand.
You can combine five ways of customizing the appearance:
| Surface | What you change | How |
|---|---|---|
| Style colors | Toolbar, status bar, chat bubbles, message states, chat list, settings, profile and more | DiyalogEngine.diyalogInstance().style (Color reference) |
| Typography | Font scale, font family / typeface, text style, text and hint colors for all SDK text | DiyalogStyle.setTypography*() (Typography) |
| Online Help | Online Help toolbar, background, text, back arrow, agent avatar and images | DiyalogStyle.setOnlineHelp*() (OnlineHelp Screens) |
| Custom layouts | Replace the alert dialog, chat app bar and chat input panel with your own XML | DiyalogEngine.set*LayoutResId() (Custom Layouts) |
| Resource overrides | SDK color resources and themes | Declare resources with the same name in your app (Overriding SDK resources) |
General rules#
- All color setters take an
intcolor (ARGB). UseColor.parseColor("#RRGGBB")orContextCompat.getColor(context, R.color.x). - Passing
0to a color setter means "use the SDK default". Most defaults are derived from the main color, so setting onlysetMainColor(...)already re-brands most of the SDK. - Every customization is optional. If you set nothing, the SDK uses its default look.
- Typography changes are applied each time an SDK screen resumes. Color changes are picked up the next time a screen or list item is drawn. To be safe, apply style changes before opening SDK screens.
Quick start#
This example re-brands the most visible parts of the SDK:
Color reference#
All setters below are on DiyalogStyle and take an int color unless stated otherwise. "Main" means the value falls back to the main color.
Brand and general#
| Setter | Affects |
|---|---|
setMainColor | Primary brand color (default #4d74a6). Used as fallback by most other colors. |
setMainBackgroundColor | Main screen background (default white) |
setBackyardBackgroundColor | Secondary background behind content areas |
setPrimaryAltColor, setPrimaryAltHoveredColor, setPrimaryAltPressedColor | Alternative primary color and its states |
setAccentColor, setAccentHoveredColor, setAccentPressedColor | Accent color and its states |
setToolBarColor | Toolbar background (default: main) |
setStatusBarColor | Status bar color (default: main) |
setGradientToolbar(int drawableRes) | Drawable resource (e.g. a gradient) used as toolbar background |
setNotificationColor | Notification accent color |
setFabColor, setFabPressedColor, setMainFabbgColor | Floating action button |
setAvatarBackgroundColor | Background behind avatar placeholders |
setAvatarBackgroundResource(int drawableRes) | Drawable used behind avatar placeholders |
Chat screen (conversation)#
| Setter | Affects |
|---|---|
setChatBackgroundColor | Conversation background |
setDefaultBackgrouds(int[] drawableRes) | Wallpaper drawables offered to the user (the method name is spelled this way) |
setOwnMessageBackgroundColor | Outgoing message bubble |
setOwnMessageTextColor | Outgoing message text |
setOwnMessageTimerColor | Outgoing message time |
setReceivedMessageBackgroundColor | Incoming message bubble |
setReceivedMessageTextColor | Incoming message text |
setConvTextColor, setConvTimeColor | General conversation text and time |
setConvSendEnabledColor, setConvSendDisabledColor | Send button, enabled / disabled |
setConvDateLineColor, setConvDatetextColor, setConvDateBgColor | Date separator chips |
setConvStatePendingColor, setConvStateSentColor, setConvStateDeliveredColor, setConvStateReadColor, setConvStateErrorColor, setConvStateWarrningColor | Message status ticks (the spelling "Warrning" is as in the API) |
setConvMediaDateBgColor | Time chip on media messages |
setConvMediaStatePendingColor ... setConvMediaStateWarrningColor | Status ticks on media messages (same six states) |
setConvLikeColor | Like / reaction color |
setSearchHighlightColor | Highlight of search matches in messages |
setRecordIconTintColor | Voice record icon tint |
setCallBackgroundColor | Call screen background |
Chat list (dialogs)#
| Setter | Affects |
|---|---|
setDialogsTitleColor | Chat name |
setDialogsTextColor | Last message preview |
setDialogsTimeColor | Last message time |
setDialogsTypingColor | "typing..." text |
setDialogsActiveTextColor | Highlighted / active text |
setDialogsCounterTextColor, setDialogsCounterBackgroundColor | Unread badge |
setDialogsDividerColor | Row divider |
setDialogsStatePendingColor, setDialogsStateSentColor, setDialogsStateDeliveredColor, setDialogsStateReadColor, setDialogsStateErrorColor | Status ticks in the list |
Text, dividers and lists#
| Setter | Affects |
|---|---|
setTextPrimaryColor, setTextSecondaryColor, setTextHintColor, setTextSubHeaderColor | Text on light backgrounds |
setTextPrimaryInvColor, setTextSecondaryInvColor, setTextHintInvColor, setTextSubheaderInvColor | Text on dark / colored backgrounds (e.g. toolbar) |
setDividerColor, setDividerInvColor | Dividers |
setListActionColor | Action rows in lists and settings titles |
setSectonIconSmallColor, setSectionIconLargeColor | Section icons (the spelling "Secton" is as in the API) |
Contacts, settings, profile and groups#
| Setter | Affects |
|---|---|
setContactFastTitleColor, setContactDividerColor | Contact list index letters and dividers |
setActionAddContactColor, setActionShareColor | Add contact / share actions |
setSettingsCategoryTextColor, setSettingsIconColor, setSettingsTitleColor, setSettingsSubtitleColor | Settings screen |
setProfileTitleColor, setProfileSubtitleColor, setProfileIconColor, setProfileContactIconColor | Profile screen |
setGroupAdminColor, setGroupOnlineColor | Group member labels |
setGroupActionAddIconColor, setGroupActionAddTextColor | "Add member" action |
Typography#
Available from SDK 5.14.0. Typography settings apply to all text in SDK screens, including messages and the chat list. They are re-applied every time an SDK screen resumes, so changes made at runtime appear without restarting the app.
| Setter | Value | Default / reset |
|---|---|---|
setTypographyFontScale(float) | Multiplier for the original text size, e.g. 1.15f | 1.0. Values <= 0 reset to 1.0. |
setTypographyFontFamily(String) | System family name, e.g. "sans-serif-medium", "serif", "monospace" | null \= SDK fonts (Roboto) |
setTypographyTypeface(Typeface) | Any Typeface, e.g. a font from res/font. Has priority over the family. | null \= not used |
setTypographyTextStyle(int) | Typeface.NORMAL, BOLD, ITALIC, BOLD_ITALIC | DiyalogStyle.TYPOGRAPHY_TEXT_STYLE_KEEP (keep each view's own style) |
setTypographyTextColor(int) | Color applied to SDK text | 0 \= keep original colors |
setTypographyHintTextColor(int) | Color applied to input hints | 0 \= keep original |
Example: use a brand font#
Example: reset typography to SDK defaults#
Tip:
setTypographyTextColoroverrides the text colors set in the Color reference (including bubble text). Leave it at0if you want bubble and list colors to stay different from each other.
Custom layouts#
Available from SDK 5.14.0. You can replace three SDK UI parts with your own Android layout XML. The SDK still drives the behavior and finds your views by view id.
| Part | Register with | Used in |
|---|---|---|
| Alert dialog | setAlertDialogLayoutResId(int) and optional setAlertDialogThemeResId(int) | All SDK confirmation / info dialogs |
| Chat app bar | setChatAppBarLayoutResId(int) | Header of the chat screen |
| Chat input panel | setChatInputPanelLayoutResId(int) | Message composer at the bottom of the chat screen |
Required view ids, layout skeletons and a checklist for each part are on the Custom Layouts page.
Overriding SDK resources#
Android merges library resources with app resources. If your app declares a resource with the same name as an SDK resource, your value wins. You can use this for colors that DiyalogStyle does not cover.
Main SDK color resources:
| Resource | Used for |
|---|---|
primary, primaryDark, primary_hovered, primary_pressed, primary_text | Primary color and its states |
primary_alt*, accent, accent_hovered, accent_pressed | Alternative and accent colors (accent is the theme colorAccent) |
action, action_hovered, action_pressed | Action elements |
secondary*, selector_*, selector_messages* | Secondary colors and touch selectors |
whatsapp_reply_accent, whatsapp_reply_accent_incoming | Reply preview accent strip |
conv_date_bg, conv_media_date_bg, conv_online, conv_offline | Chat date chip, media chip, online / offline |
end_call, upload_overlay | Call end button, upload overlay |
picker_main_color, picker_controller_background_* | Media / file picker |
Important: Prefer
DiyalogStylewhenever a setter exists. Many colors that used to be resources are now driven byDiyalogStyle, so overriding a resource with the same name has no effect for those. Resource names are internal and may change between SDK versions; check them after each SDK upgrade.
SDK themes (for example ChatActivityTheme, MainActivityTheme, AlertDialogStyle, PickerTheme) can also be overridden by name, but this replaces the whole theme. Copy the original definition from the SDK and change only what you need.
Other appearance options#
These are on DiyalogEngine.diyalogInstance():
| Method | Effect |
|---|---|
setAppIcon(int drawableRes) | Small icon used in SDK notifications |
setAppLogo(int drawableRes) | App logo shown by the SDK |
setShowWallpaperCategory(boolean) | Show or hide the wallpaper option in settings |
setShowSetting*View(boolean) | Show or hide individual rows in SDK settings |
setHomeBackButtonEnabled(boolean) | Show the back button on the SDK home screen |
Dark mode#
The SDK does not switch to a dark theme automatically (it has no values-night resources). If your app supports dark mode, set a dark palette on DiyalogStyle yourself, for example based on the current UI mode:
ProGuard / R8#
No extra rules are needed. The SDK ships consumer ProGuard rules that keep DiyalogStyle (all setters, getters and enums), the DiyalogEngine.style field and all custom-layout methods.
Your custom layout XML files and their ids belong to your app. Because they are referenced from code (R.layout.*), resource shrinking keeps them.
Known limitations#
In SDK 5.14.1 the following setters exist but have no visible effect. Do not rely on them:
setMessageSendContainerColor,setMessageSendFrameColor,setMessageSendTextBackgroundColor,setMessageSendTextColor,setMessageSendTextHintColor. To style the composer, use a custom input panel.setSettingsMainTitleColor. The settings main title usessetListActionColor.setTextSecondaryAccentColor. UsesetTextSecondaryColorinstead.
Other limitations:
- Custom layouts are all-or-nothing: a layout with a missing required id is ignored.
- Custom app bar and input panel layouts are not used on Online Help screens.
- There is no automatic dark mode (see Dark mode).
Integration checklist#
- Style is applied in
Application.onCreate()beforecreateDiyalog(...). - At least
setMainColor, toolbar / status bar and bubble colors are set to brand values. - Typography: the font loads correctly and long texts still fit at your chosen font scale.
- Online Help: toolbar, back arrow and agent avatar match the brand.
- Custom layouts: all required ids present with correct types; the root of the input panel is a
LinearLayout. - Opened a 1:1 chat and a group chat; checked title, avatar, presence, typing and unread badge.
- Sent text, attachment, reply and voice message using the custom input panel.
- Triggered an SDK dialog (e.g. logout) and checked the custom alert.
- Tested a release (R8-minified) build.
Troubleshooting#
| Symptom | Likely cause |
|---|---|
| Colors do not change | Style set after the screen was already shown, or a resource override was used where a DiyalogStyle setter exists |
| A color stays the same even after setting it | The setter is in the Known limitations list |
| All SDK text has the same color | setTypographyTextColor is set; reset it to 0 |
| SDK default app bar / input panel still shown | A required id is missing or has the wrong type, or the setter was called after the chat was opened |
| Avatar not shown in custom app bar | avatarPreview is not an AvatarView |
| Send button does not tint | ib_send is not a TintImageView |
| Attach menu / mentions overlap the input | Panel height or gravity differs from the sample; keep bottom alignment like the sample layout |