Themes

Everything you see in WhatsZori is drawn with CSS custom properties whose names start with --wz-. A theme overrides some of them. Class names are stable too, so a theme can restyle specific parts, but variables come first: they survive app updates much better than selectors do.

The smallest theme

Save this as teal.css in the themes folder (Settings → Themes → Open themes folder), then turn it on in the same place:

/* @name Teal */
:root {
  --wz-accent: #2b7a78;
}

Everything accent-coloured follows: selection, buttons, unread badges, your own message bubbles, links. Changes apply as soon as you save the file, with no restart.

Light and dark

The app sets data-theme="light" or data-theme="dark" on <html>. Light values live on :root, dark ones on [data-theme='dark']:

:root {
  --wz-bg-primary: #fbfaf7;
  --wz-bg-conversation: #f2efe8;
}

[data-theme='dark'] {
  --wz-bg-primary: #1c1b19;
  --wz-bg-conversation: #161513;
}

CarefulWhatever you set on :root, also set under [data-theme='dark']. Both selectors have the same specificity, so a value you only set on :root leaks into dark mode.

Keep body text at a contrast of at least 4.5:1 against the surface it sits on.

Single-file themes

Any .css file directly in the themes folder is a theme. Only one of them can be on at a time, on top of whatever built-in theme is active. An optional comment at the very top gives it a name in the settings:

/*
 * @name Dusk
 * @id dusk
 * @author You
 * @version 1.0.0
 * @description Warm greys and an orange accent.
 */

Without it, the file name is used.

Theme folders

A bigger theme is a folder with a manifest.json and several CSS files, called modules. The user can turn modules on and off separately, the way the built-in Adwaita theme lets you keep its colours but skip its header bars.

themes/ocean/
  manifest.json
  palette.css
  parts/
    waves.css
    waves.svg
    round.css
{
  "id": "ocean",
  "name": "Ocean",
  "version": "1.0.0",
  "author": "You",
  "description": "Deep blue accent with a wave pattern behind messages.",
  "layout": "panels",
  "modules": [
    { "id": "palette", "name": "Palette", "file": "palette.css", "required": true },
    { "id": "waves", "name": "Waves", "file": "parts/waves.css" },
    { "id": "round", "name": "Rounder bubbles", "file": "parts/round.css", "default": false }
  ]
}
Field
id Must be the folder name: letters, digits, ., -, _. It can't be the id of a built-in theme.
name, version, author, description Shown in the settings
layout panels or rail. Turning the theme on switches the window to that layout; the user can switch back.
modules[].id Unique within the theme
modules[].file A .css file inside the folder, at most 1 MB
modules[].required Always on, no switch shown
modules[].default Starting state of an optional module; on when left out

Enabled modules are joined in manifest order into one <style data-wz-theme="ocean"> at the end of <head>. <html data-wz-themes="…"> lists the active themes, if your CSS needs to know.

Images and fonts

Relative url()s in a module point into the theme's folder, relative to that module file:

/* parts/waves.css */
.wz-message-list {
  background-image: url(waves.svg); /* loads ocean/parts/waves.svg */
  background-size: 240px 60px;
}

That works for @font-face too. Absolute URLs and data: URLs are left alone.

When a folder can't load

A theme folder with a problem shows up under Theme folders that can't load in the settings, with the reason: a missing file, an id that doesn't match the folder, invalid JSON. Folders whose names start with _ or . are ignored; _wallpapers is where chat wallpapers are kept.

Targeting parts of the app

When a variable isn't enough, use the stable class names. They start with wz-, follow a BEM-like pattern and are listed in the reference. For example, to give bubbles a tail-less, rounder look:

.wz-bubble {
  border-radius: 18px;
}

Avoid selectors on element structure (div > div > span). The markup changes between versions, but the wz- classes are kept on purpose.

Things to keep in mind

  • The user's accent wins. If someone picked an accent colour, it's set inline on <html> and beats your --wz-accent. That's intended.
  • Private variables are fine. A theme can define its own (--ocean-*) and map them onto --wz-*. Adwaita does this with --adw-*.
  • Wallpaper. A chat wallpaper the user picked sits above your message background. If you want to style around it, <html> has data-wz-wallpaper while one is set.
  • Notifications. On Windows, WhatsZori's notification cards run the same CSS, so your theme applies there too. They have their own variables.
  • Reduced motion. The duration variables become 0 when the system asks for reduced motion. Use them for your transitions instead of fixed times.

Examples

The WhatsZori repository has a single-file theme and a theme folder to start from. The built-in themes are in frontend/src/themes and are written the same way.