{%- block doctype -%}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
{%- endblock %}
{%- set reldelim1 = reldelim1 is not defined and ' &raquo;' or reldelim1 %}
{%- set reldelim2 = reldelim2 is not defined and ' |' or reldelim2 %}
{%- set url_root = pathto('', 1) %}
{%- if url_root == '#' %}{% set url_root = '' %}{% endif %}

{%- macro relbar() %}
    <div class="related">
      <ul>
        <li><a href="//kivy.org">Homepage</a> - </li>
        <li><a href="{{ pathto(master_doc) }}">Documentation</a></li>
        {#
        {%- for parent in parents %}
          <li><a href="{{ parent.link|e }}" {% if loop.last %}{{ accesskey("U") }}{% endif %}>{{ parent.title }}</a>{{ reldelim1 }}</li>
        {%- endfor %}
        {%- block relbaritems %} {% endblock %}
        #}
      </ul>
    </div>
{%- endmacro %}

{%- macro header() %}
      {%- if not embedded %}{% if not theme_nosidebar|tobool %}
      <div class="header">
        <div class="headerwrapper">
          {%- if pagename != "search" %}
          <div id="searchbox" style="display: none">
              <form class="search" action="{{ pathto('search') }}" method="get">
                <input type="text" name="q" size="18" />
                <input type="submit" value="{{ _('Go') }}" />
                <input type="hidden" name="check_keywords" value="yes" />
                <input type="hidden" name="area" value="default" />
              </form>
          </div>
          <script type="text/javascript">$('#searchbox').show(0);</script>
          {%- endif %}
        </div>
      </div>
      {%- endif %}{% endif %}
{%- endmacro %}

{%- macro sidebar() %}
      {%- if not embedded %}{% if not theme_nosidebar|tobool %}
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
            <h3>Version</h3>
            <select id="version_selector"></select>
            <h3>Quick search</h3>
            <form class="search" action="{{ pathto('search') }}" method="get">
                <input type="hidden" name="check_keywords" value="yes" />
                <input type="hidden" name="area" value="default" />
                <input type="text" class="text" name="q" />
                <button type="submit">{{ _('Go') }}</button>
            </form>
          {%- block sidebartoc %}
          <!--
          <h3><a href="{{ pathto(master_doc) }}">{{ title }}</a></h3>
          {{ toc }}
          <h3><a href="{{ pathto(master_doc) }}">{{ _('Table Of Contents') }}</a></h3>
          -->
          {{ toctree(collapse=False) }}
          {%- endblock %}
          {%- block sidebarrel %}
          <!--
          <h3>Related Topics</h3>
          <ul>
              {%- if prev %}
              <li>Previous: <a href="{{ prev.link|e }}" title="{{ _('previous chapter') }}">{{ prev.title }}</a></li>
              {%- endif %}
              {%- if next %}
              <li>Next: <a href="{{ next.link|e }}" title="{{ _('next chapter') }}">{{ next.title }}</a></li>
              {%- endif %}
          </ul>
          -->
          {%- endblock %}
        </div>
      </div>
      {%- endif %}{% endif %}
{%- endmacro %}

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="twitter:site" content="@kivyframework">
    <meta name="color-scheme" content="dark light"> <!--tells web browser about which themes are supported -->
    {{ metatags }}
    {%- if not embedded and docstitle %}
      {%- set titlesuffix = " &mdash; "|safe + docstitle|e %}
    {%- else %}
      {%- set titlesuffix = "" %}
    {%- endif %}
    <title>{{ title|striptags }}{{ titlesuffix }}</title>
    <link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,700' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" href="{{ pathto('_static/pygments.css', 1) }}" type="text/css" />
    {%- for style in styles %} 
      <link rel="stylesheet" href="{{ pathto('_static/' + style, 1) }}" type="text/css" />
    {%- endfor %} 

    {%- if not embedded %}
    {%- block scripts %}
        {% if sphinx_version >= "1.8.0" %} 
          <script type="text/javascript" id="documentation_options" data-url_root="{{ pathto('', 1) }}" src="{{ pathto('_static/documentation_options.js', 1) }}"></script> 
          {%- for scriptfile in script_files %} 
            {{ js_tag(scriptfile) }} 
          {%- endfor %} 
        {% else %} 
          <script type="text/javascript"> 
              var DOCUMENTATION_OPTIONS = { 
                  URL_ROOT:'{{ url_root }}', 
                  VERSION:'{{ release|e }}', 
                  LANGUAGE:'{{ language }}', 
                  COLLAPSE_INDEX:false, 
                  FILE_SUFFIX:'{{ '' if no_search_suffix else file_suffix }}', 
                  HAS_SOURCE:  {{ has_source|lower }}, 
                  SOURCELINK_SUFFIX: '{{ sourcelink_suffix }}' 
              }; 
          </script> 
          {%- for scriptfile in script_files %} 
            <script type="text/javascript" src="{{ pathto(scriptfile, 1) }}"></script> 
          {%- endfor %}
        {% endif %}
        <script>
            const currTheme = localStorage.getItem("theme");
            if(currTheme){
                document.documentElement.className = currTheme;
            } else if(window.matchMedia){
                document.documentElement.className = window.matchMedia('(prefers-color-scheme: dark)').matches ? "dark": "light";
            } else { // neither localStorage or window.matchMedia exists
                document.documentElement.className = "light"; //todo should dark theme be the fallback value instead ?
            }
        </script>
        <script type="text/javascript" src="{{ pathto('_static/jquery-effects-core-and-slide.js', 1) }}"></script>
        <script type="text/javascript" src="{{ pathto('_static/jquery.cookie.js', 1) }}"></script>
        <script type="text/javascript" src="{{ pathto('_static/kivy.js', 1) }}"></script>
    {%- endblock %}
    {%- if use_opensearch %}
    <link rel="search" type="application/opensearchdescription+xml"
          title="{% trans docstitle=docstitle|e %}Search within {{ docstitle }}{% endtrans %}"
          href="{{ pathto('_static/opensearch.xml', 1) }}"/>
    {%- endif %}
    {%- if favicon %}
    <link rel="shortcut icon" href="{{ pathto('_static/' + favicon, 1) }}"/>
    {%- endif %}
    {%- endif %}
{%- block linktags %}
    {%- if hasdoc('about') %}
    <link rel="author" title="{{ _('About these documents') }}" href="{{ pathto('about') }}" />
    {%- endif %}
    {%- if hasdoc('genindex') %}
    <link rel="index" title="{{ _('Index') }}" href="{{ pathto('genindex') }}" />
    {%- endif %}
    {%- if hasdoc('search') %}
    <link rel="search" title="{{ _('Search') }}" href="{{ pathto('search') }}" />
    {%- endif %}
    {%- if hasdoc('copyright') %}
    <link rel="copyright" title="{{ _('Copyright') }}" href="{{ pathto('copyright') }}" />
    {%- endif %}
    <link rel="top" title="{{ docstitle|e }}" href="{{ pathto('index') }}" />
    {%- if parents %}
    <link rel="up" title="{{ parents[-1].title|striptags }}" href="{{ parents[-1].link|e }}" />
    {%- endif %}
    {%- if next %}
    <link rel="next" title="{{ next.title|striptags }}" href="{{ next.link|e }}" />
    {%- endif %}
    {%- if prev %}
    <link rel="prev" title="{{ prev.title|striptags }}" href="{{ prev.link|e }}" />
    {%- endif %}
{%- endblock %}
{%- block extrahead %} {% endblock %}
  </head>
  <body>
{%- block header %}{% endblock %}

{%- block relbar1 %}{% endblock %}

    <div id="topbar">
        <div id="topwrapper">
          <div id="toplogo">
              <a href="https://kivy.org/">
                  <img src="{{ pathto('_static/logo-kivy.png', 1) }}" alt="Kivy"/>
              </a>
          </div>
          <div id="topmenu">
              <ul class="navigation">
                  <li><a class="nav-guides" href="{{ pathto('gettingstarted/intro') }}">Guides</a></li>
                  <li><a class="nav-garden" href="http://kivy-garden.github.io/">Garden</a></li>
                  <li><a class="nav-api" href="{{ pathto('api-kivy') }}">API Reference</a></li>
                  <li><a class="nav-pdf" href="https://media.readthedocs.org/pdf/kivy/latest/kivy.pdf">PDF</a></li>
                  <li><a class="nav-wiki" href="http://wiki.kivy.org">Wiki</a></li>
                  <li id="li_themeToggleSwitch">
                        <button id="themeToggleSwitch" type="button">
                            <span class="vt-switch-check">
                                <span class="vt-switch-icon">
                                    <!--[-->
                                    <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewBox="0 0 24 24" class="sun">
                                        <path d="M12,18c-3.3,0-6-2.7-6-6s2.7-6,6-6s6,2.7,6,6S15.3,18,12,18zM12,8c-2.2,0-4,1.8-4,4c0,2.2,1.8,4,4,4c2.2,0,4-1.8,4-4C16,9.8,14.2,8,12,8z"></path>
                                        <path d="M12,4c-0.6,0-1-0.4-1-1V1c0-0.6,0.4-1,1-1s1,0.4,1,1v2C13,3.6,12.6,4,12,4z"></path>
                                        <path d="M12,24c-0.6,0-1-0.4-1-1v-2c0-0.6,0.4-1,1-1s1,0.4,1,1v2C13,23.6,12.6,24,12,24z"></path>
                                        <path d="M5.6,6.6c-0.3,0-0.5-0.1-0.7-0.3L3.5,4.9c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l1.4,1.4c0.4,0.4,0.4,1,0,1.4C6.2,6.5,5.9,6.6,5.6,6.6z"></path>
                                        <path d="M19.8,20.8c-0.3,0-0.5-0.1-0.7-0.3l-1.4-1.4c-0.4-0.4-0.4-1,0-1.4s1-0.4,1.4,0l1.4,1.4c0.4,0.4,0.4,1,0,1.4C20.3,20.7,20,20.8,19.8,20.8z"></path>
                                        <path d="M3,13H1c-0.6,0-1-0.4-1-1s0.4-1,1-1h2c0.6,0,1,0.4,1,1S3.6,13,3,13z"></path>
                                        <path d="M23,13h-2c-0.6,0-1-0.4-1-1s0.4-1,1-1h2c0.6,0,1,0.4,1,1S23.6,13,23,13z"></path>
                                        <path d="M4.2,20.8c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l1.4-1.4c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-1.4,1.4C4.7,20.7,4.5,20.8,4.2,20.8z"></path>
                                        <path d="M18.4,6.6c-0.3,0-0.5-0.1-0.7-0.3c-0.4-0.4-0.4-1,0-1.4l1.4-1.4c0.4-0.4,1-0.4,1.4,0s0.4,1,0,1.4l-1.4,1.4C18.9,6.5,18.6,6.6,18.4,6.6z"></path>
                                    </svg>
                                    <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" viewBox="0 0 24 24" class="moon">
                                        <path d="M12.1,22c-0.3,0-0.6,0-0.9,0c-5.5-0.5-9.5-5.4-9-10.9c0.4-4.8,4.2-8.6,9-9c0.4,0,0.8,0.2,1,0.5c0.2,0.3,0.2,0.8-0.1,1.1c-2,2.7-1.4,6.4,1.3,8.4c2.1,1.6,5,1.6,7.1,0c0.3-0.2,0.7-0.3,1.1-0.1c0.3,0.2,0.5,0.6,0.5,1c-0.2,2.7-1.5,5.1-3.6,6.8C16.6,21.2,14.4,22,12.1,22zM9.3,4.4c-2.9,1-5,3.6-5.2,6.8c-0.4,4.4,2.8,8.3,7.2,8.7c2.1,0.2,4.2-0.4,5.8-1.8c1.1-0.9,1.9-2.1,2.4-3.4c-2.5,0.9-5.3,0.5-7.5-1.1C9.2,11.4,8.1,7.7,9.3,4.4z"></path>
                                    </svg>
                                    <!--]-->
                                </span>
                            </span>
                        </button>

                  </li>
              </ul>
          </div>
        </div>
    </div>

{%- block document %}
<div id="contentall">
  {%- block sidebar1 %}{{ sidebar() }}{% endblock %}
  <div id="content">
    <div class="wrapper">
      <div class="documentwrapper">
      {%- if not embedded %}{% if not theme_nosidebar|tobool %}
        <div class="bodywrapper">
      {%- endif %}{% endif %}
          <div class="body">
            <div class="toc"><h2>{{ _('Table Of Contents') }}</h2>{{ toc }}</div>
            {% block body %} {% endblock %}
            <div class="footerlinks">
            {%- if prev or next %}
            <table>
                <tr>
                    <td class="leftlink">
                  {%- if prev %}
                  <a href="{{ prev.link|e }}" title="{{ _('previous chapter') }}">&laquo; {{ prev.title }}</a></li>
                  {%- endif %}
                  </td>
                  <td class="rightlink">
                  {%- if next %}
                  <a href="{{ next.link|e }}" title="{{ _('next chapter') }}">{{ next.title }} &raquo;</a>
                  {%- endif %}
                      </td>
                  </tr>
              </table>
              {%- endif %}
              </div>
          </div>
      {%- if not embedded %}{% if not theme_nosidebar|tobool %}
        </div>
      {%- endif %}{% endif %}
      </div>
    </div>
    <div class="clearer"></div>
  </div>
</div>
{%- endblock %}

{%- block footer %}
<!-- Piwik -->
<script>
  var selector = $("#version_selector");

  selector.on('change', function() {
    // replace the version part of the url with the selected version
    document.location.pathname = document.location.pathname.replace(
      /^(\/.*?\/).*?(\/.*)/,
     '$1' + this.value + '$2'
    );
  });

  var url = "/doc/versions.json";

  $.getJSON(url, function(versions) {
    versions.forEach(function(version){
      var current = window.location.pathname.split('/')[2]
      selector.append(
        $("<option " + (version == current ? "selected" : "") + "/>").val(version).html(version)
      );
    });
  });
</script>
<!-- End Piwik Tracking Code -->
    <!--
    <div class="footer">
    {%- if hasdoc('copyright') %}
      {% trans path=pathto('copyright'), copyright=copyright|e %}&copy; <a href="{{ path }}">Copyright</a> {{ copyright }}.{% endtrans %}
    {%- else %}
      {% trans copyright=copyright|e %}&copy; Copyright {{ copyright }}.{% endtrans %}
    {%- endif %}
    {%- if last_updated %}
      {% trans last_updated=last_updated|e %}Last updated on {{ last_updated }}.{% endtrans %}
    {%- endif %}
    {%- if show_sphinx %}
      {% trans sphinx_version=sphinx_version|e %}Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> {{ sphinx_version }}.{% endtrans %}
    {%- endif %}
</div>
-->
{%- endblock %}
  </body>
</html>
