telegram-crawler/data/web/blogfork.telegram.org/api/themes.html
2024-09-17 22:21:45 +00:00

190 lines
16 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<title>Themes</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="description" content="Telegram apps support generating, sharing and synchronizing app themes.">
<meta property="og:title" content="Themes">
<meta property="og:image" content="">
<meta property="og:description" content="Telegram apps support generating, sharing and synchronizing app themes.">
<link rel="icon" type="image/svg+xml" href="/img/website_icon.svg?4">
<link rel="apple-touch-icon" sizes="180x180" href="/img/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/favicon-16x16.png">
<link rel="alternate icon" href="/img/favicon.ico" type="image/x-icon" />
<link href="/css/bootstrap.min.css?3" rel="stylesheet">
<link href="/css/telegram.css?240" rel="stylesheet" media="screen">
<style>
</style>
</head>
<body class="preload">
<div class="dev_page_wrap">
<div class="dev_page_head navbar navbar-static-top navbar-tg">
<div class="navbar-inner">
<div class="container clearfix">
<ul class="nav navbar-nav navbar-right hidden-xs"><li class="navbar-twitter"><a href="https://twitter.com/telegram" target="_blank" data-track="Follow/Twitter" onclick="trackDlClick(this, event)"><i class="icon icon-twitter"></i><span> Twitter</span></a></li></ul>
<ul class="nav navbar-nav">
<li><a href="//telegram.org/">Home</a></li>
<li class="hidden-xs"><a href="//telegram.org/faq">FAQ</a></li>
<li class="hidden-xs"><a href="//telegram.org/apps">Apps</a></li>
<li class="active"><a href="/api">API</a></li>
<li class=""><a href="/mtproto">Protocol</a></li>
<li class=""><a href="/schema">Schema</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="dev_page">
<div id="dev_page_content_wrap" class=" ">
<div class="dev_page_bread_crumbs"><ul class="breadcrumb clearfix"><li><a href="/api" >API</a></li><i class="icon icon-breadcrumb-divider"></i><li><a href="/api/themes" >Themes</a></li></ul></div>
<h1 id="dev_page_title">Themes</h1>
<div id="dev_page_content"><!-- scroll_nav -->
<p>Telegram apps support generating, sharing and synchronizing app themes.</p>
<h3><a class="anchor" href="#uploading-theme-files" id="uploading-theme-files" name="uploading-theme-files"><i class="anchor-icon"></i></a>Uploading theme files</h3>
<pre><code><a href='/constructor/document'>document</a>#8fd4c4d8 flags:<a href='/type/%23'>#</a> id:<a href='/type/long'>long</a> access_hash:<a href='/type/long'>long</a> file_reference:<a href='/type/bytes'>bytes</a> date:<a href='/type/int'>int</a> mime_type:<a href='/type/string'>string</a> size:<a href='/type/long'>long</a> thumbs:flags.0?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/PhotoSize'>PhotoSize</a>&gt; video_thumbs:flags.1?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/VideoSize'>VideoSize</a>&gt; dc_id:<a href='/type/int'>int</a> attributes:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/DocumentAttribute'>DocumentAttribute</a>&gt; = <a href='/type/Document'>Document</a>;
---functions---
<a href='/method/account.uploadTheme'>account.uploadTheme</a>#1c3db333 flags:<a href='/type/%23'>#</a> file:<a href='/type/InputFile'>InputFile</a> thumb:flags.0?<a href='/type/InputFile'>InputFile</a> file_name:<a href='/type/string'>string</a> mime_type:<a href='/type/string'>string</a> = <a href='/type/Document'>Document</a>;</code></pre>
<p><a href="/themes">Theme files</a> can be uploaded using <a href="/method/account.uploadTheme">account.uploadTheme</a>: optionally a JPEG thumbnail for the theme can also be provided to <code>thumb</code>.<br>
The resulting document should be used when <a href="#creating-themes">creating</a> or <a href="#updating-themes">updating</a> themes.</p>
<p>The actual content of the theme file depends on the formats supported by the theming engine of the client. </p>
<h3><a class="anchor" href="#creating-themes" id="creating-themes" name="creating-themes"><i class="anchor-icon"></i></a>Creating themes</h3>
<pre><code><a href='/constructor/baseThemeClassic'>baseThemeClassic</a>#c3a12462 = <a href='/type/BaseTheme'>BaseTheme</a>;
<a href='/constructor/baseThemeDay'>baseThemeDay</a>#fbd81688 = <a href='/type/BaseTheme'>BaseTheme</a>;
<a href='/constructor/baseThemeNight'>baseThemeNight</a>#b7b31ea8 = <a href='/type/BaseTheme'>BaseTheme</a>;
<a href='/constructor/baseThemeTinted'>baseThemeTinted</a>#6d5f77ee = <a href='/type/BaseTheme'>BaseTheme</a>;
<a href='/constructor/baseThemeArctic'>baseThemeArctic</a>#5b11125a = <a href='/type/BaseTheme'>BaseTheme</a>;
<a href='/constructor/inputWallPaper'>inputWallPaper</a>#e630b979 id:<a href='/type/long'>long</a> access_hash:<a href='/type/long'>long</a> = <a href='/type/InputWallPaper'>InputWallPaper</a>;
<a href='/constructor/inputWallPaperSlug'>inputWallPaperSlug</a>#72091c80 slug:<a href='/type/string'>string</a> = <a href='/type/InputWallPaper'>InputWallPaper</a>;
<a href='/constructor/inputWallPaperNoFile'>inputWallPaperNoFile</a>#967a462e id:<a href='/type/long'>long</a> = <a href='/type/InputWallPaper'>InputWallPaper</a>;
<a href='/constructor/wallPaperSettings'>wallPaperSettings</a>#372efcd0 flags:<a href='/type/%23'>#</a> blur:flags.1?<a href='/constructor/true'>true</a> motion:flags.2?<a href='/constructor/true'>true</a> background_color:flags.0?<a href='/type/int'>int</a> second_background_color:flags.4?<a href='/type/int'>int</a> third_background_color:flags.5?<a href='/type/int'>int</a> fourth_background_color:flags.6?<a href='/type/int'>int</a> intensity:flags.3?<a href='/type/int'>int</a> rotation:flags.4?<a href='/type/int'>int</a> emoticon:flags.7?<a href='/type/string'>string</a> = <a href='/type/WallPaperSettings'>WallPaperSettings</a>;
<a href='/constructor/inputThemeSettings'>inputThemeSettings</a>#8fde504f flags:<a href='/type/%23'>#</a> message_colors_animated:flags.2?<a href='/constructor/true'>true</a> base_theme:<a href='/type/BaseTheme'>BaseTheme</a> accent_color:<a href='/type/int'>int</a> outbox_accent_color:flags.3?<a href='/type/int'>int</a> message_colors:flags.0?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/int'>int</a>&gt; wallpaper:flags.1?<a href='/type/InputWallPaper'>InputWallPaper</a> wallpaper_settings:flags.1?<a href='/type/WallPaperSettings'>WallPaperSettings</a> = <a href='/type/InputThemeSettings'>InputThemeSettings</a>;
<a href='/constructor/theme'>theme</a>#a00e67d6 flags:<a href='/type/%23'>#</a> creator:flags.0?<a href='/constructor/true'>true</a> default:flags.1?<a href='/constructor/true'>true</a> for_chat:flags.5?<a href='/constructor/true'>true</a> id:<a href='/type/long'>long</a> access_hash:<a href='/type/long'>long</a> slug:<a href='/type/string'>string</a> title:<a href='/type/string'>string</a> document:flags.2?<a href='/type/Document'>Document</a> settings:flags.3?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/ThemeSettings'>ThemeSettings</a>&gt; emoticon:flags.6?<a href='/type/string'>string</a> installs_count:flags.4?<a href='/type/int'>int</a> = <a href='/type/Theme'>Theme</a>;
---functions---
<a href='/method/account.createTheme'>account.createTheme</a>#652e4400 flags:<a href='/type/%23'>#</a> slug:<a href='/type/string'>string</a> title:<a href='/type/string'>string</a> document:flags.2?<a href='/type/InputDocument'>InputDocument</a> settings:flags.3?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/InputThemeSettings'>InputThemeSettings</a>&gt; = <a href='/type/Theme'>Theme</a>;</code></pre>
<p>Use <a href="/method/account.createTheme">account.createTheme</a> to create a theme, see the <a href="/method/account.createTheme">method page for more info about the parameters »</a>.</p>
<p>The resulting theme can be shared by generating a <a href="/api/links#theme-links">theme deep link »</a> using either a user-provided <code>slug</code>, or an autogenerated one by leaving the <code>slug</code> parameter empty and using the returned <code>slug</code>.</p>
<h3><a class="anchor" href="#updating-themes" id="updating-themes" name="updating-themes"><i class="anchor-icon"></i></a>Updating themes</h3>
<pre><code><a href='/constructor/inputTheme'>inputTheme</a>#3c5693e9 id:<a href='/type/long'>long</a> access_hash:<a href='/type/long'>long</a> = <a href='/type/InputTheme'>InputTheme</a>;
<a href='/constructor/inputThemeSlug'>inputThemeSlug</a>#f5890df1 slug:<a href='/type/string'>string</a> = <a href='/type/InputTheme'>InputTheme</a>;
<a href='/constructor/updateTheme'>updateTheme</a>#8216fba3 theme:<a href='/type/Theme'>Theme</a> = <a href='/type/Update'>Update</a>;
---functions---
<a href='/method/account.updateTheme'>account.updateTheme</a>#2bf40ccc flags:<a href='/type/%23'>#</a> format:<a href='/type/string'>string</a> theme:<a href='/type/InputTheme'>InputTheme</a> slug:flags.0?<a href='/type/string'>string</a> title:flags.1?<a href='/type/string'>string</a> document:flags.2?<a href='/type/InputDocument'>InputDocument</a> settings:flags.3?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/InputThemeSettings'>InputThemeSettings</a>&gt; = <a href='/type/Theme'>Theme</a>;</code></pre>
<p>A previously uploaded theme can be modified by the creator using <a href="/method/account.updateTheme">account.updateTheme</a>, passing the same parameters used when <a href="#creating-themes">creating themes</a>, along with an <a href="/type/InputTheme">InputTheme</a> containing the ID and access hash parameters from the <a href="/constructor/theme">theme</a> constructor returned by <a href="/method/account.createTheme">account.createTheme</a> or <a href="/method/account.getTheme">account.getTheme</a>. </p>
<p>All users that have installed this theme will receive an <a href="/constructor/updateTheme">updateTheme</a> with the updated theme. </p>
<h3><a class="anchor" href="#installing-themes" id="installing-themes" name="installing-themes"><i class="anchor-icon"></i></a>Installing themes</h3>
<pre><code><a href='/constructor/inputTheme'>inputTheme</a>#3c5693e9 id:<a href='/type/long'>long</a> access_hash:<a href='/type/long'>long</a> = <a href='/type/InputTheme'>InputTheme</a>;
<a href='/constructor/inputThemeSlug'>inputThemeSlug</a>#f5890df1 slug:<a href='/type/string'>string</a> = <a href='/type/InputTheme'>InputTheme</a>;
<a href='/constructor/theme'>theme</a>#a00e67d6 flags:<a href='/type/%23'>#</a> creator:flags.0?<a href='/constructor/true'>true</a> default:flags.1?<a href='/constructor/true'>true</a> for_chat:flags.5?<a href='/constructor/true'>true</a> id:<a href='/type/long'>long</a> access_hash:<a href='/type/long'>long</a> slug:<a href='/type/string'>string</a> title:<a href='/type/string'>string</a> document:flags.2?<a href='/type/Document'>Document</a> settings:flags.3?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/ThemeSettings'>ThemeSettings</a>&gt; emoticon:flags.6?<a href='/type/string'>string</a> installs_count:flags.4?<a href='/type/int'>int</a> = <a href='/type/Theme'>Theme</a>;
<a href='/constructor/themeSettings'>themeSettings</a>#fa58b6d4 flags:<a href='/type/%23'>#</a> message_colors_animated:flags.2?<a href='/constructor/true'>true</a> base_theme:<a href='/type/BaseTheme'>BaseTheme</a> accent_color:<a href='/type/int'>int</a> outbox_accent_color:flags.3?<a href='/type/int'>int</a> message_colors:flags.0?<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/int'>int</a>&gt; wallpaper:flags.1?<a href='/type/WallPaper'>WallPaper</a> = <a href='/type/ThemeSettings'>ThemeSettings</a>;
<a href='/constructor/account.themesNotModified'>account.themesNotModified</a>#f41eb622 = <a href='/type/account.Themes'>account.Themes</a>;
<a href='/constructor/account.themes'>account.themes</a>#9a3d8c6d hash:<a href='/type/long'>long</a> themes:<a href='/type/Vector%20t'>Vector</a>&lt;<a href='/type/Theme'>Theme</a>&gt; = <a href='/type/account.Themes'>account.Themes</a>;
---functions---
<a href='/method/account.saveTheme'>account.saveTheme</a>#f257106c theme:<a href='/type/InputTheme'>InputTheme</a> unsave:<a href='/type/Bool'>Bool</a> = <a href='/type/Bool'>Bool</a>;
<a href='/method/account.installTheme'>account.installTheme</a>#c727bb3b flags:<a href='/type/%23'>#</a> dark:flags.0?<a href='/constructor/true'>true</a> theme:flags.1?<a href='/type/InputTheme'>InputTheme</a> format:flags.2?<a href='/type/string'>string</a> base_theme:flags.3?<a href='/type/BaseTheme'>BaseTheme</a> = <a href='/type/Bool'>Bool</a>;
<a href='/method/account.getTheme'>account.getTheme</a>#3a5869ec format:<a href='/type/string'>string</a> theme:<a href='/type/InputTheme'>InputTheme</a> = <a href='/type/Theme'>Theme</a>;
<a href='/method/account.getThemes'>account.getThemes</a>#7206e458 format:<a href='/type/string'>string</a> hash:<a href='/type/long'>long</a> = <a href='/type/account.Themes'>account.Themes</a>;</code></pre>
<p>Once you've <a href="#creating-themes">created your theme</a> or received a <a href="/api/links#theme-links">theme deep link</a>, it can be installed as follows. </p>
<p>First of all, to get info about a theme from a <a href="/api/links#theme-links">theme deep link</a> use <a href="/method/account.getTheme">account.getTheme</a> with <a href="/constructor/inputThemeSlug">inputThemeSlug</a>. </p>
<p>The API keeps a list of theme that the user can apply.<br>
To fetch the list use <a href="/method/account.getThemes">account.getThemes</a>.<br>
To save a theme to the list use <a href="/method/account.saveTheme">account.saveTheme</a> with <code>unsave=false</code>.<br>
To remove a theme from the list use <a href="/method/account.saveTheme">account.saveTheme</a> with <code>unsave=true</code>. </p>
<p>When a client applies a theme, call <a href="/method/account.installTheme">account.installTheme</a> to signal the installation to the server. </p>
<p>In all methods, <code>format</code> indicates the theme format, a string that identifies the theming engines supported by the client.</p></div>
</div>
</div>
</div>
<div class="footer_wrap">
<div class="footer_columns_wrap footer_desktop">
<div class="footer_column footer_column_telegram">
<h5>Telegram</h5>
<div class="footer_telegram_description"></div>
Telegram is a cloud-based mobile and desktop messaging app with a focus on security and speed.
</div>
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
<ul>
<li><a href="//telegram.org/faq">FAQ</a></li>
<li><a href="//telegram.org/privacy">Privacy</a></li>
<li><a href="//telegram.org/press">Press</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#mobile-apps">Mobile Apps</a></h5>
<ul>
<li><a href="//telegram.org/dl/ios">iPhone/iPad</a></li>
<li><a href="//telegram.org/android">Android</a></li>
<li><a href="//telegram.org/dl/web">Mobile Web</a></li>
</ul>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps#desktop-apps">Desktop Apps</a></h5>
<ul>
<li><a href="//desktop.telegram.org/">PC/Mac/Linux</a></li>
<li><a href="//macos.telegram.org/">macOS</a></li>
<li><a href="//telegram.org/dl/web">Web-browser</a></li>
</ul>
</div>
<div class="footer_column footer_column_platform">
<h5><a href="/">Platform</a></h5>
<ul>
<li><a href="/api">API</a></li>
<li><a href="//translations.telegram.org/">Translations</a></li>
<li><a href="//instantview.telegram.org/">Instant View</a></li>
</ul>
</div>
</div>
<div class="footer_columns_wrap footer_mobile">
<div class="footer_column">
<h5><a href="//telegram.org/faq">About</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/blog">Blog</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/apps">Apps</a></h5>
</div>
<div class="footer_column">
<h5><a href="/">Platform</a></h5>
</div>
<div class="footer_column">
<h5><a href="//telegram.org/press">Press</a></h5>
</div>
</div>
</div>
</div>
<script src="/js/main.js?47"></script>
<script src="/js/jquery.min.js?1"></script>
<script src="/js/bootstrap.min.js?1"></script>
<script>window.initDevPageNav&&initDevPageNav();
backToTopInit("Go up");
removePreloadInit();
</script>
</body>
</html>