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"] } }
}
formatmust be"televo-theme".versionis the major version: a document with a version above the reader’s is refused (server:versionproblem; 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:
lightand/ordark. 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):
| Key | Key | ||
|---|---|---|---|
bg | page background | text, text_secondary, text_tertiary | text |
aurora | 3 colours, the backdrop blobs | glass | chrome fill (with glass_opacity) |
accent | 2 colours, the signature gradient | bubble_in | incoming bubbles (with bubble_opacity) |
accent_text | 2 colours, text-bearing gradient (my bubbles, badges); derived from accent when omitted | accent_solid | links, icons, toggles |
danger, success, warning | status |
Tokens (numbers; outside the range = rejected by the server, clamped by apps):
| Token | Range | Soft Glass light / dark |
|---|---|---|
radius_bubble | 8 – 28 | 20 / 20 |
radius_card | 12 – 32 | 24 / 24 |
radius_button | 6 – 24 | 14 / 14 |
glass_blur | 0 – 40 (σ; 0 = no blur) | 24 / 28 |
glass_opacity | 0.40 – 0.95 | 0.62 / 0.58 |
bubble_opacity | 0.70 – 1.00 | 0.82 / 0.78 |
aurora_opacity | 0 – 0.60 | 0.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:
type | Fields |
|---|---|
aurora | the Soft Glass backdrop of the variant (default) |
solid | color |
gradient | colors (2–4; 3–4 = a soft four-corner blend like Telegram’s), angle 0–359 |
pattern | colors (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 |
image | asset in a theme / file of a stored wallpaper |
wallpaper | themes 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, GetInstalledThemes | GetInstalledThemes 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) |
GetBaseThemes | presets, 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 |
GetChatWallpapers | all 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 viaGetInstalledThemes). 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 withcreates_join_request, §20).JoinChatby id answersCHAT_NOT_FOUND. - Private ↔ public.
SetChatUsernamewith 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 answerUSERNAME_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>andtelevo://privatepost?channel=&post=resolve (ResolveMessageLink) for members only. Everyone else getsCHAT_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 isjoin_required+invite_hashand nothing else: showCheckInviteLink, 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/getChatMemberon a private channel need the bot to be a member (an admin for member data); otherwisechat not found.
Generated from docs/PROTOCOL.md in the Telvoro repository. Wire names such as televo.v1 are unchanged.