Developer docs

24. Themes and wallpapers

On this page

themes.proto, ThemesService (login required). Validation: server/internal/themefmt (Go) and sdk/dart/lib/src/themes (Dart) implement the same rules over the same server/internal/themefmt/presets.json; a parity test keeps them equal.

24.1 The theme format (televo-theme, version 1)

A theme is one JSON document, declarative only (no code, no expressions, no URLs). It is the same on all six platforms and is also the export file format (<slug>.televo-theme.json).

{
  "format": "televo-theme",
  "version": 1,
  "name": "Coral",
  "base": "soft_glass",
  "light": {
    "colors": { "accent": ["#E0565B", "#D97706"], "bg": "#F4F5FB" },
    "tokens": { "radius_bubble": 16, "glass_opacity": 0.7 },
    "wallpaper": { "type": "image", "asset": "bg", "dim": 0.2 }
  },
  "dark": { "colors": { "accent": ["#E0565B", "#D97706"] } }
}
  • format must be "televo-theme". version is the major version: a document with a version above the reader’s is refused (server: version problem; apps: “update the app”). Additions that old readers can ignore do not bump it: unknown keys are ignored everywhere, and a server stores the document verbatim, so newer keys survive.
  • base: one of the built-in base themes (GetBaseThemes): soft_glass (light + dark, the default), paper (light), midnight (dark, OLED black), tinted (dark). Every value a variant leaves out comes from the base’s same variant, else from Soft Glass.
  • Variants: light and/or dark. A theme with one variant is used for both system appearances (it fixes the brightness); with both, the app follows the system/the user’s light-dark choice.
  • name ≤ 64 characters without control or bidi-override characters. Document ≤ 16 KiB.

Colours are #RRGGBB (opaque; translucency comes from the opacity tokens):

KeyKey
bgpage backgroundtext, text_secondary, text_tertiarytext
aurora3 colours, the backdrop blobsglasschrome fill (with glass_opacity)
accent2 colours, the signature gradientbubble_inincoming bubbles (with bubble_opacity)
accent_text2 colours, text-bearing gradient (my bubbles, badges); derived from accent when omittedaccent_solidlinks, icons, toggles
danger, success, warningstatus

Tokens (numbers; outside the range = rejected by the server, clamped by apps):

TokenRangeSoft Glass light / dark
radius_bubble8 – 2820 / 20
radius_card12 – 3224 / 24
radius_button6 – 2414 / 14
glass_blur0 – 40 (σ; 0 = no blur)24 / 28
glass_opacity0.40 – 0.950.62 / 0.58
bubble_opacity0.70 – 1.000.82 / 0.78
aurora_opacity0 – 0.600.42 / 0.40

Contrast (WCAG AA, 4.5:1), computed on the resolved variant: text and text_secondary on bg, on glass composited over bg, and on bubble_in composited over bg and over each wallpaper colour (solid/gradient/pattern, after dim); accent_solid on bg; white on both accent_text stops and their midpoint. When accent is set without accent_text, accent_text = each accent stop multiplied by 0.94 until white reaches 4.6:1 (both implementations take the same steps). The server refuses a document that fails; apps run a guard when they apply any theme (including one cached from an older server) that moves failing text colours toward black/white, darkens accent_text and raises bubble_opacity/glass_opacity until every rule holds. A theme can’t make text unreadable. (Image wallpapers are not sampled yet: their legibility relies on dim and the bubble opacity floor of 0.70.)

24.2 Wallpapers

A wallpaper is a JSON object, used inside a theme variant (wallpaper), stored on its own (CreateWallpaper, Wallpaper.spec) or set per chat:

typeFields
aurorathe Soft Glass backdrop of the variant (default)
solidcolor
gradientcolors (2–4; 3–4 = a soft four-corner blend like Telegram’s), angle 0–359
patterncolors (1–4, the gradient below), angle, intensity 0.05–1 (pattern opacity), and pattern (a built-in tile: dots, waves, grid, triangles, confetti, hexagons) or a PNG tile (asset in a theme / file of a stored wallpaper); the tile is tinted
imageasset in a theme / file of a stored wallpaper
wallpaperthemes only: slug of a stored wallpaper

Common: blur (bool), dim 0–0.8 (black overlay), motion (bool, parallax; stored and synced, not rendered by the current apps). Light and dark are separate: a theme carries one per variant; the global default and every per-chat wallpaper have a light and a dark slot.

Files: CreateTheme.assets[{name, file_id, pattern}] / CreateWallpaper.file_id take my own upload (JPEG/PNG/WebP/GIF ≤ 10 MB). The server decodes it with the photo pixel limits (≤ 10 000 px a side, ≤ 40 MP, checked from the header before decoding) and re-encodes it — JPEG ≤ 2560 px for images, PNG ≤ 1024 px with alpha for pattern tiles — plus a ≤ 40 px JPEG thumb; the original upload is never served as the wallpaper. Errors: WALLPAPER_FILE_INVALID, WALLPAPER_TOO_LARGE.

24.3 Methods

CreateTheme{slug?, title, document, assets}validates, stores version 1 and installs it for me; slug [a-z0-9_]{5,32} (generated when empty)
UpdateTheme{slug, title?, document?, assets, remove_assets}author only; version + 1; installers get Update.theme_updated
DeleteTheme, GetTheme{slug}, InstallTheme, UninstallTheme, GetMyThemes, GetInstalledThemesGetInstalledThemes carries current versions: apps compare on start and refetch changed ones
ValidateTheme{document, assets}structured ThemeProblem{path, rule, detail}; Create/Update fail with THEME_INVALID (problems in the message)
GetBaseThemespresets, suggested accents, format_version
CreateWallpaper{spec, file_id?, dark}, GetWallpaper{slug}, GetMyWallpapers, DeleteWallpaper
SetChatWallpaper{chat_id, light?, dark?, for_both, reset_default}a variant is a stored wallpaper (slug) or an inline spec without a file; for_both (private chats, not when the peer blocked me) also sets the peer’s, marked set_by = me; the peer can reset_default theirs
GetChatWallpapersall my per-chat wallpapers

Quotas (THEMES_TOO_MUCH, WALLPAPERS_TOO_MUCH): 20 themes / 50 wallpapers, Premium 100 / 200 (§17.2). At most 4 assets per theme.

Links: televo://addtheme/<slug> and https://<host>/addtheme/<slug> (apps show a preview and install on confirmation); televo://bg/<slug> and https://<host>/bg/<slug>.

24.4 Updates

  • Update.theme_updated{slug, version, taken_down, deleted} (ephemeral) goes to every installer (up to 100 000 live per publish; the rest catch up via GetInstalledThemes). A taken-down or deleted theme is no longer served: apps fall back to their base theme.
  • UserEvent.themes_changed (logged, synced across my devices): my installed / my themes / my wallpapers changed.
  • UserEvent.chat_wallpaper (logged): a chat’s wallpaper for me changed — by me on another device, or by the peer “for both sides” (set_by), or reset (removed).

24.5 Chat themes

Telegram’s emoji-named chat themes (one preset applied for both sides) are deferred: “set for both sides” with a stored wallpaper covers the shared look; a chat-level theme would need a second token set in every chat screen. Not in version 1 of the format.

24.6 Reports and takedown

ReportService/Report takes theme_slug, wallpaper_slug or langpack_slug (instead of a chat/user target). Reports show up in the admin console with target_kind and target_ref. Admin API: GET /admin/v1/themes/{slug}, POST /admin/v1/themes/{slug}/takedown {"down", "reason"} (reversible; installers get taken_down), POST /admin/v1/wallpapers/{slug}/takedown (permanent, file released), POST /admin/v1/langpacks/{client}/{code}/takedown (§15.1).

22.10 Private channels

A channel (or group) without a username is private:

  • Joining works only through an invite link (JoinByInvite) or an approved join request (links with creates_join_request, §20). JoinChat by id answers CHAT_NOT_FOUND.
  • Private ↔ public. SetChatUsername with a name makes it public: it appears in public search and on the web, and its posts get /<username>/<id> links. An empty name makes it private again. The old username is released and its links answer USERNAME_NOT_OCCUPIED (also on the web: 404). /c/<chat_id>/<id> links and invite links keep working for members throughout.
  • Post links. /c/<chat_id>/<post> and televo://privatepost?channel=&post= resolve (ResolveMessageLink) for members only. Everyone else gets CHAT_NOT_FOUND, the same as an id that doesn’t exist, with no title, text or counts. When the link came with an invite (ResolveMessageLinkRequest.invite) that is valid for that chat, the answer is join_required + invite_hash and nothing else: show CheckInviteLink, join, then resolve again.
  • Never public. The web preview and embed pages answer 404. Public search (UsersService/Search, the public name index) and similar-channel recommendations (built from public channels only, and filtered again at read time) never include it. Members still find it among their own chats in search.
  • Discussion. A private channel’s discussion group can stay private. Threads are readable through the channel only by its members, and comments need the channel (the auto-join on the first comment requires being able to read the channel).
  • Admin log, statistics, boosts, streams work exactly as for public channels, for members and admins.
  • Bot API. getChat / getChatMember on a private channel need the bot to be a member (an admin for member data); otherwise chat not found.

Generated from docs/PROTOCOL.md in the Telvoro repository. Wire names such as televo.v1 are unchanged.