Messaging UI - Themes, Colors and Customize Screen

This page describes the colors of the messaging UI, the light and dark themes, saved looks (customizations), and the Customize screen.

Colors

A color is a 32-bit value, 0xAARRGGBB. In JSON it is "#AARRGGBB" or "#RRGGBB".

Every color has a default for the light theme and one for the dark theme. setDefaults(dark) sets them. A color is always the exact color shown; there is no “0 means default”.

The theme group has the colors shared by all screens:

SettingLightDarkUsed for
accentColor#FF00A884#FF00A884buttons, switches, selected items
toolbarColor, toolbarTextColor, toolbarIconColorwhite, #FF111B21#FF1F2C34, #FFE9EDEFthe toolbar, its title and its icons
backgroundColor#FFFFFFFF#FF111B21the background of the screens
surfaceColor#FFF0F2F5#FF202C33cards, sheets, the search field
textPrimaryColor, textSecondaryColor#FF111B21, #FF667781#FFE9EDEF, #FF8696A0text, and less important text
dividerColor, borderColor#FFE9EDEF, #FFD1D7DB#FF222D34, #FF374248separators, outlines
errorColor#FFEA0038#FFF15C6Derrors and destructive actions
selectionColor#3300A884#4400A884selected rows and messages
inputBackgroundColor#FFFFFFFF#FF2A3942the message input
chipBackgroundColor, chipTextColor#FFFFFFFF, #FF54656F#FF182229, #FF8696A0dates in a chat
quoteBackgroundColor#14000000#26FFFFFFa quoted message
noticeBackgroundColor#FFFFF5C4#FF182229notices in a chat
metaColor#FF667781#FF99AAB4the time in a message
linkColor#FF027EB5#FF53BDEBlinks, phone numbers and emails
onlineColor#FF25D366#FF25D366the online dot
patternColor, wallpaperDimColor#12000000, transparent#0DFFFFFF, #59000000the wallpaper pattern, and the dim over a wallpaper photo
onAccentColor, onMediaColorwhitewhitetext and icons on the accent color, and over pictures
mediaScrimColor, dimColor, shadowColor#66000000, #59000000, blackthe samebehind text over pictures, behind sheets, shadows
toastBackgroundColor, toastTextColor#E01A1A1A, whitethe sameshort messages
letterAvatarTextColor, letterAvatarColorswhite, a palettethe sameletter avatars

Other groups have the colors of their own parts:

GroupColors
messageAppearancebackgroundColor, myBubbleColor, peerBubbleColor, myTextColor, peerTextColor
voiceMessageswaveColor, myPlayedColor, peerPlayedColor, recordingColor
userListbackgroundColor, nameColor, messageColor, readIconColor, sensitiveIconColor, muteActionColor, archiveActionColor
messageStatusthe icons by the time of a message, see Message status

A color of a group comes from its own settings or from theme, never from another group.

The app sets colors in MesiboUI_onConfig, for both themes:

@Override
public void MesiboUI_onConfig(MesiboUiConfig config, boolean dark) {
    config.theme.toolbarColor = 0xff00868b;
    config.theme.toolbarTextColor = 0xffffffff;
    config.theme.toolbarIconColor = 0xffffffff;
    config.theme.accentColor = 0xff00868b;
    if (!dark)
        config.messageAppearance.myBubbleColor = 0xffd9fdd3;
}
override fun MesiboUI_onConfig(config: MesiboUiConfig, dark: Boolean) {
    config.theme.toolbarColor = 0xff00868b.toInt()
    config.theme.toolbarTextColor = 0xffffffff.toInt()
    config.theme.toolbarIconColor = 0xffffffff.toInt()
    config.theme.accentColor = 0xff00868b.toInt()
    if (!dark)
        config.messageAppearance.myBubbleColor = 0xffd9fdd3.toInt()
}
func MesiboUI_onConfig(config: MesiboUiConfig, dark: Bool) {
    config.theme.toolbarColor = 0xff00868b
    config.theme.toolbarTextColor = 0xffffffff
    config.theme.toolbarIconColor = 0xffffffff
    config.theme.accentColor = 0xff00868b
    if !dark {
        config.messageAppearance.myBubbleColor = 0xffd9fdd3
    }
}
- (void)MesiboUI_onConfig:(MesiboUiConfig *)config dark:(BOOL)dark {
    config.theme.toolbarColor = 0xff00868b;
    config.theme.toolbarTextColor = 0xffffffff;
    config.theme.toolbarIconColor = 0xffffffff;
    config.theme.accentColor = 0xff00868b;
    if (!dark)
        config.messageAppearance.myBubbleColor = 0xffd9fdd3;
}
MesiboUiConfig config = await MesiboUI().getConfig();
config.theme.toolbarColor = 0xff00868b;
config.theme.accentColor = 0xff00868b;
await MesiboUI().setConfig(config);

The defaults of a theme

A new MesiboUiConfig has the defaults of the light theme. setDefaults(true) sets the dark theme’s colors, setDefaults(false) the light theme’s.

To write a customization based on a theme’s defaults: set the defaults, change the settings, then write the configuration as JSON.

MesiboUiConfig config = new MesiboUiConfig();
config.setDefaults(true);                       // the dark theme's colors; false: the light theme's
config.theme.accentColor = 0xff7e57c2;          // the changes
String json = config.toJson(false);             // every setting, with its value
val config = MesiboUiConfig()
config.setDefaults(true)                        // the dark theme's colors; false: the light theme's
config.theme.accentColor = 0xff7e57c2.toInt()   // the changes
val json = config.toJson(false)                 // every setting, with its value
let config = MesiboUiConfig()
config.setDefaults(true)                        // the dark theme's colors; false: the light theme's
config.theme.accentColor = 0xff7e57c2           // the changes
let json = config.toJson(false)                 // every setting, with its value
MesiboUiConfig *config = [MesiboUiConfig new];
[config setDefaults:YES];                       // the dark theme's colors; NO: the light theme's
config.theme.accentColor = 0xff7e57c2;          // the changes
NSString *json = [config toJson:NO];            // every setting, with its value

Text size

messageAppearance.textSize sets the size of the text of messages. The size also follows the text size set in the system.

SizeAndroidiOSJSON
SmallMesiboUI.TEXTSIZE_SMALLMESIBO_TEXTSIZE_SMALL"small"
Medium (default)MesiboUI.TEXTSIZE_MEDIUMMESIBO_TEXTSIZE_MEDIUM"medium"
LargeMesiboUI.TEXTSIZE_LARGEMESIBO_TEXTSIZE_LARGE"large"
Extra largeMesiboUI.TEXTSIZE_EXTRALARGEMESIBO_TEXTSIZE_EXTRALARGE"extra_large"

Wallpaper

The chat background is, in this order of priority:

  1. messageAppearance.wallpaperPath: a picture file.
  2. messageAppearance.wallpaperImage: a picture set in code (Bitmap on Android, UIImage on iOS).
  3. messageAppearance.backgroundColor, with a faint pattern when messageAppearance.showWallpaperPattern is on.

wallpaperPath is a full path, or a file name in mesibo’s own folder:

  • Android: files/mesiboui in the app’s files.
  • iOS: Application Support/MesiboUI. A file name stays valid when iOS moves the app’s folder on an update.

The Customize screen keeps the photos the user chooses in that folder. In the dark theme, a wallpaper photo is dimmed with theme.wallpaperDimColor, so the bubbles stay readable.

Light and dark theme

By default, the messaging UI follows the system’s light or dark setting, also when it changes while the app runs. setTheme selects a theme. It applies at once; the open screens are drawn again.

MesiboUI.setTheme(MesiboUI.THEME_SYSTEM); // or MesiboUI.THEME_LIGHT, MesiboUI.THEME_DARK
MesiboUI.setTheme(MesiboUI.THEME_SYSTEM) // or MesiboUI.THEME_LIGHT, MesiboUI.THEME_DARK
MesiboUI.setTheme(MESIBO_THEME_SYSTEM) // or MESIBO_THEME_LIGHT, MESIBO_THEME_DARK
[MesiboUI setTheme:MESIBO_THEME_SYSTEM]; // or MESIBO_THEME_LIGHT, MESIBO_THEME_DARK
MesiboUI().setTheme(MesiboUI.THEME_SYSTEM); // or MesiboUI.THEME_LIGHT, MesiboUI.THEME_DARK

Each time a theme is applied, mesibo makes a new configuration:

  1. It sets the theme’s defaults (setDefaults).
  2. It applies the customization saved for that theme, if any (see Customizations).
  3. It calls the app’s MesiboUI_onConfig.

The open screens then use the new configuration. Settings made on an earlier configuration are lost, so the app sets its settings in MesiboUI_onConfig, not once at start-up.

Customizations

A customization is a JSON of settings for the light theme or for the dark theme. It comes from the Customize screen, or from the app’s server. mesibo keeps one customization per theme, in mesibo’s key-value store, and applies it each time that theme is applied. mesibo must be set up before the customization functions are used.

FunctionAndroidiOSFlutter
Save the customization of a theme; an empty JSON deletes it. Saving does not apply itMesiboUI.saveCustomization(json, dark)[MesiboUI saveCustomization:json dark:dark]MesiboUI().saveCustomization(json, dark)
Get the saved customization; null (nil) if noneMesiboUI.getCustomization(dark)[MesiboUI getCustomization:dark]MesiboUI().getCustomization(dark)
Apply the current theme again, with its saved customizationMesiboUI.applyCustomization()[MesiboUI applyCustomization]MesiboUI().applyCustomization()

applyCustomization does nothing when the current theme is applied and its customization has not changed since.

To use a customization from the server at once:

MesiboUI.saveCustomization(json, false);
MesiboUI.applyCustomization();
MesiboUI.saveCustomization(json, false)
MesiboUI.applyCustomization()
MesiboUI.saveCustomization(json, dark: false)
MesiboUI.applyCustomization()
[MesiboUI saveCustomization:json dark:NO];
[MesiboUI applyCustomization];
await MesiboUI().saveCustomization(json, false);
await MesiboUI().applyCustomization();

Customize screen

launchCustomize opens the Customize screen. The user chooses the look of the messaging UI for the current theme, light or dark. The screen has three tabs, each with a preview:

TabSettings
Themeready-made palettes, the accent color, the toolbar colors
Chat listthe background, name and last message colors, letter avatars, the search mode, filters, archived chats, swipe actions, online indicator, profile popup
Chata wallpaper photo, bubble and text colors, the colors of the icons by the time, the text size, wallpaper pattern, bubble tail, large emoji, swipe to reply, covering the user’s own sensitive messages

Changes are not applied while the user edits. The buttons:

  • Back closes the screen. If something changed, it first asks: Discard the changes, or Cancel to stay.
  • Apply calls the app’s callback with the customization as JSON: the changes, merged with the customization saved before for that theme. dark tells which theme it is for.
  • Reset calls the callback with an empty JSON. The customization of that theme, and its wallpaper photo, are deleted.

The callback saves the customization to keep it. It returns true (YES) to apply it now, or false (NO) to leave the screens unchanged. Without a callback, the changes are applied at once but not saved.

MesiboUI.launchCustomize(context, (json, dark) -> {
    MesiboUI.saveCustomization(json, dark);   // empty after Reset: deleted
    return true;
});
MesiboUI.launchCustomize(context) { json, dark ->
    MesiboUI.saveCustomization(json, dark)    // empty after Reset: deleted
    true
}
MesiboUI.launchCustomize(self) { json, dark in
    MesiboUI.saveCustomization(json, dark: dark)   // empty after Reset: deleted
    return true
}
[MesiboUI launchCustomize:self closed:^BOOL(NSString *json, BOOL dark) {
    [MesiboUI saveCustomization:json dark:dark];   // empty after Reset: deleted
    return YES;
}];
MesiboUI().launchCustomize((json, dark) {
  MesiboUI().saveCustomization(json, dark);   // empty after Reset: deleted
});

A wallpaper photo chosen by the user is already saved in mesibo’s folder. The JSON has its file name in messageAppearance.wallpaperPath.

On Android, a tap on a color shows a grid of colors and a field for a color code. On iOS, it opens the system color picker.