Add optional dark theme for the docs

This commit is contained in:
Lonami Exo
2018-05-23 18:50:28 +02:00
parent bb0d29bdd5
commit c3e5d390eb
5 changed files with 235 additions and 24 deletions

View File

@@ -4,7 +4,16 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Telethon API</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="css/docs.css" rel="stylesheet">
<link id="style" href="css/docs.light.css" rel="stylesheet">
<script>
try {
which = document.cookie.split('=')[1].split(';')[0];
if (which) {
document.getElementById("style").href = "css/" + which;
}
} catch (e) {
}
</script>
<link href="https://fonts.googleapis.com/css?family=Nunito|Source+Code+Pro" rel="stylesheet">
<style>
body {
@@ -21,7 +30,7 @@
on what the methods, constructors and types mean. Nevertheless, this
page aims to provide easy access to all the available methods, their
definition and parameters.</p>
<p id="themeSelect"></p>
<p>Please note that when you see this:</p>
<pre>---functions---
users.getUsers#0d91a548 id:Vector&lt;InputUser&gt; = Vector&lt;User&gt;</pre>
@@ -145,5 +154,17 @@ users.getUsers#0d91a548 id:Vector&lt;InputUser&gt; = Vector&lt;User&gt;</pre>
</p>
</div>
<script src="js/search.js"></script>
<script>
document.getElementById("themeSelect").innerHTML = `
Select
<a href="#" onclick="setTheme('docs.light.css')">light</a> /
<a href="#" onclick="setTheme('docs.dark.css')">dark</a> theme.
`;
function setTheme(which) {
style.href = "css/" + which;
document.cookie = "css=" + which + "; path=/";
}
</script>
</body>
</html>