Skip to content

Commit d74fb8b

Browse files
authored
Merge pull request #50 from KubaO/staging
Add dark/light theme switching
2 parents 6715777 + 4daf03e commit d74fb8b

7 files changed

Lines changed: 17357 additions & 0 deletions

File tree

‎docs/_config.yml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ defaults:
1919
path: "*/Images"
2020
values:
2121
image: true
22+
- scope:
23+
path: "assets/css"
24+
values:
25+
render_with_liquid: true
2226

2327
# GitHub-style admonitions are supported, but we may wish to add custom
2428
# callouts below.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<nav aria-label="Auxiliary" class="aux-nav">
2+
{%- comment -%} from: https://github.com/mmcesim/mmcesim.org/blob/master/_includes/components/aux_nav.html {%- endcomment -%}
3+
<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
4+
<symbol id="svg-sun" viewBox="0 0 24 24">
5+
<title>Light mode</title>
6+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
7+
stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="feather-sun">
8+
<circle cx="12" cy="12" r="5"></circle>
9+
<line x1="12" y1="1" x2="12" y2="3"></line>
10+
<line x1="12" y1="21" x2="12" y2="23"></line>
11+
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line>
12+
<line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line>
13+
<line x1="1" y1="12" x2="3" y2="12"></line>
14+
<line x1="21" y1="12" x2="23" y2="12"></line>
15+
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line>
16+
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line>
17+
</svg>
18+
</symbol>
19+
<symbol id="svg-moon" viewBox="0 0 24 24">
20+
<title>Dark mode</title>
21+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
22+
stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-moon">
23+
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
24+
<path d="M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454z" />
25+
</svg>
26+
</symbol>
27+
</svg>
28+
<ul class="aux-nav-list">
29+
<li class="aux-nav-list-item">
30+
<span id="theme-toggle" class="site-button"><svg width='18px' height='18px'><use href="#svg-sun"></use></svg></span>
31+
</li>
32+
{% for link in site.aux_links %}
33+
<li class="aux-nav-list-item">
34+
<a href="{{ link.last }}" class="site-button"
35+
{% if site.aux_links_new_tab %}
36+
target="_blank" rel="noopener noreferrer"
37+
{% endif %}
38+
>
39+
{{ link.first }}
40+
</a>
41+
</li>
42+
{% endfor %}
43+
</ul>
44+
</nav>

‎docs/_includes/head.html‎

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<head>
2+
<meta charset="UTF-8">
3+
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
4+
5+
{%- comment -%} this bit from https://github.com/mmcesim/mmcesim.org/blob/master/_includes/head.html {%- endcomment -%}
6+
<script>
7+
if (localStorage.getItem('theme') === 'dark') document.documentElement.classList.add('dark-mode');
8+
</script>
9+
<script type="text/javascript" src="{{ '/assets/js/theme-switch.js' | relative_url }}" defer></script>
10+
<link rel="stylesheet" href="{{ '/assets/css/just-the-docs-switchable.css' | relative_url }}">
11+
12+
{%- comment -%}
13+
<!-- these are jtd original stylesheets, just for reference -->
14+
<link rel="stylesheet" href="{{ '/assets/css/just-the-docs-default.css' | relative_url }}">
15+
16+
<link rel="stylesheet" href="{{ '/assets/css/just-the-docs-head-nav.css' | relative_url }}" id="jtd-head-nav-stylesheet">
17+
{%- endcomment -%}
18+
19+
<style id="jtd-nav-activation">
20+
{% include css/activation.scss.liquid %}
21+
</style>
22+
23+
{% if site.ga_tracking != nil %}
24+
{% assign ga_tracking_ids = site.ga_tracking | split: "," %}
25+
<script async src="https://www.googletagmanager.com/gtag/js?id={{ ga_tracking_ids.first }}"></script>
26+
<script>
27+
window.dataLayer = window.dataLayer || [];
28+
function gtag(){dataLayer.push(arguments);}
29+
gtag('js', new Date());
30+
31+
{% for ga_property in ga_tracking_ids %}
32+
gtag('config', '{{ ga_property }}'{% unless site.ga_tracking_anonymize_ip == nil %}, { 'anonymize_ip': true }{% endunless %});
33+
{% endfor %}
34+
</script>
35+
{% endif %}
36+
37+
{% if site.search_enabled != false %}
38+
<script src="{{ '/assets/js/vendor/lunr.min.js' | relative_url }}"></script>
39+
{% endif %}
40+
41+
<script src="{{ '/assets/js/just-the-docs.js' | relative_url }}"></script>
42+
43+
<meta name="viewport" content="width=device-width, initial-scale=1">
44+
45+
{% include_cached favicon.html %}
46+
47+
{% seo %}
48+
49+
{% include head_custom.html %}
50+
51+
</head>

‎docs/_sass/readme.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
> [!WARNING]
2+
>
3+
> At the moment, the sass/scss stylesheets are not used. They are still generated, but the html doesn't reference them. This can be improved in the future.

0 commit comments

Comments
 (0)