Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbcb78b6

Browse files
authored
Merge pull request#44 from septatrix/dark-theme
2 parents93cb464 +84f34ae commitbcb78b6

File tree

6 files changed

+308
-164
lines changed

6 files changed

+308
-164
lines changed

‎python_docs_theme/layout.html

Lines changed: 34 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ <h3>{{ _('Navigation') }}</h3>
3737
{{ reldelim2 }}
3838
</li>
3939
{%- endif %}
40+
<liclass="right">{{ themeselector() }}{{ reldelim2 }}</li>
4041
{% endblock %}
4142
</ul>
4243
</div>
@@ -47,25 +48,35 @@ <h3>{{ _('Navigation') }}</h3>
4748
{%- if builder != "htmlhelp" %}
4849
<divclass="inline-search"role="search">
4950
<formclass="inline-search"action="{{ pathto('search') }}"method="get">
50-
<inputplaceholder="{{ _('Quick search') }}"aria-label="{{ _('Quick search') }}"type="text"name="q"/>
51+
<inputplaceholder="{{ _('Quick search') }}"aria-label="{{ _('Quick search') }}"type="search"name="q"/>
5152
<inputtype="submit"value="{{ _('Go') }}"/>
52-
<inputtype="hidden"name="check_keywords"value="yes"/>
53-
<inputtype="hidden"name="area"value="default"/>
5453
</form>
5554
</div>
5655
{%- endif %}
5756
{%- endmacro %}
5857

58+
{%- macro themeselector() %}
59+
<labelclass="theme-selector-label">
60+
{{ _('Theme') }}
61+
<selectclass="theme-selector"oninput="activateTheme(this.value)">
62+
<optionvalue="auto"selected>{{ _('Auto') }}</option>
63+
<optionvalue="light">{{ _('Light') }}</option>
64+
<optionvalue="dark">{{ _('Dark') }}</option>
65+
</select>
66+
</label>
67+
{%- endmacro %}
68+
5969
{% block relbar1 %} {% if builder != 'qthelp' %} {{ relbar() }} {% endif %} {% endblock %}
6070
{% block relbar2 %} {% if builder != 'qthelp' %} {{ relbar() }} {% endif %} {% endblock %}
6171

62-
6372
{%- block extrahead -%}
73+
<linkrel="stylesheet"href="{{ pathto('_static/pydoctheme_dark.css', 1) }}"media="(prefers-color-scheme: dark)"id="pydoctheme_dark_css">
6474
<linkrel="shortcut icon"type="image/png"href="{{ pathto('_static/' + theme_root_icon, 1) }}"/>
6575
{%- if builder != "htmlhelp" %}
6676
{%- if not embedded %}
6777
<scripttype="text/javascript"src="{{ pathto('_static/copybutton.js', 1) }}"></script>
6878
<scripttype="text/javascript"src="{{ pathto('_static/menu.js', 1) }}"></script>
79+
<scripttype="text/javascript"src="{{ pathto('_static/themetoggle.js', 1) }}"></script>
6980
{%- endif -%}
7081
{%- endif -%}
7182
{{ super() }}
@@ -82,28 +93,30 @@ <h3>{{ _('Navigation') }}</h3>
8293
<divclass="mobile-nav">
8394
<inputtype="checkbox"id="menuToggler"class="toggler__input"aria-controls="navigation"
8495
aria-pressed="false"aria-expanded="false"role="button"aria-label="{{ _('Menu')}}"/>
85-
<labelfor="menuToggler"class="toggler__label">
86-
<span></span>
87-
</label>
8896
<navclass="nav-content"role="navigation">
89-
<ahref="{{ theme_root_url }}"class="nav-logo">
90-
<imgsrc="{{ pathto('_static/py.svg', 1) }}"alt="Logo"/>
91-
</a>
92-
<divclass="version_switcher_placeholder"></div>
93-
{%- if pagename != "search" and builder != "singlehtml" %}
94-
<formrole="search"class="search"action="{{ pathto('search') }}"method="get">
95-
<svgxmlns="http://www.w3.org/2000/svg"width="20"height="20"viewBox="0 0 24 24"class="search-icon">
96-
<pathfill-rule="nonzero"
97-
d="M15.5 14h-.79l-.28-.27a6.5 6.5 0 001.48-5.34c-.47-2.78-2.79-5-5.59-5.34a6.505 6.505 0 00-7.27 7.27c.34 2.8 2.56 5.12 5.34 5.59a6.5 6.5 0 005.34-1.48l.27.28v.79l4.25 4.25c.41.41 1.08.41 1.49 0 .41-.41.41-1.08 0-1.49L15.5 14zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"fill="#444"></path>
98-
</svg>
99-
<inputtype="text"name="q"aria-label="{{ _('Quick search') }}"/>
100-
<inputtype="submit"value="{{ _('Go') }}"/>
101-
</form>
102-
{%- endif %}
97+
<labelfor="menuToggler"class="toggler__label">
98+
<span></span>
99+
</label>
100+
<spanclass="nav-items-wrapper">
101+
<ahref="{{ theme_root_url }}"class="nav-logo">
102+
<imgsrc="{{ pathto('_static/py.svg', 1) }}"alt="Logo"/>
103+
</a>
104+
<spanclass="version_switcher_placeholder"></span>
105+
{%- if pagename != "search" and builder != "singlehtml" %}
106+
<formid="searchbox"role="search"class="search"action="{{ pathto('search') }}"method="get">
107+
<svgxmlns="http://www.w3.org/2000/svg"width="20"height="20"viewBox="0 0 24 24"class="search-icon">
108+
<pathfill-rule="nonzero"fill="currentColor"d="M15.5 14h-.79l-.28-.27a6.5 6.5 0 001.48-5.34c-.47-2.78-2.79-5-5.59-5.34a6.505 6.505 0 00-7.27 7.27c.34 2.8 2.56 5.12 5.34 5.59a6.5 6.5 0 005.34-1.48l.27.28v.79l4.25 4.25c.41.41 1.08.41 1.49 0 .41-.41.41-1.08 0-1.49L15.5 14zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path>
109+
</svg>
110+
<inputplaceholder="{{ _('Quick search') }}"aria-label="{{ _('Quick search') }}"type="search"name="q"/>
111+
<inputtype="submit"value="{{ _('Go') }}"/>
112+
</form>
113+
{%- endif %}
114+
</span>
103115
</nav>
104116
<divclass="menu-wrapper">
105117
<navclass="menu"role="navigation"aria-label="main navigation">
106118
<divclass="language_switcher_placeholder"></div>
119+
{{ themeselector() }}
107120
{%- if logo %}
108121
<pclass="logo">
109122
<ahref="{{ pathto('index') }}">

‎python_docs_theme/static/caret-down.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp