header.tpl.html

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<nav>
  <ul>
    <li><strong><a href="/">Senary</a></strong></li>
  </ul>
  <ul>
    <li><a href="/repos">Repositories</a></li>
    <li><a href="/login">{{.User.String}}</a></li>

    <li><style>
      .theme-toggle{color:var(--pico-primary);}
      .theme-toggle:focus{box-shadow:none;}
      .theme-toggle.theme-toggle--reversed .theme-toggle__expand{transform:scale(-1,1)}.theme-toggle{--theme-toggle__expand--duration:0ms}.theme-toggle__expand g circle,.theme-toggle__expand g path{transform-origin:center;transition:transform calc(var(--theme-toggle__expand--duration) * .65) cubic-bezier(0, 0, 0, 1.25) calc(var(--theme-toggle__expand--duration) * .35)}.theme-toggle__expand :first-child path{transition-property:transform,d;transition-duration:calc(var(--theme-toggle__expand--duration) * .6);transition-timing-function:cubic-bezier(0,0,0.5,1)}.theme-toggle input[type=checkbox]:checked~.theme-toggle__expand g circle,.theme-toggle--toggled:not(label).theme-toggle .theme-toggle__expand g circle{transform:scale(1.4);transition-delay:0s}.theme-toggle input[type=checkbox]:checked~.theme-toggle__expand g path,.theme-toggle--toggled:not(label).theme-toggle .theme-toggle__expand g path{transform:scale(.75);transition-delay:0s}.theme-toggle input[type=checkbox]:checked~.theme-toggle__expand :first-child path,.theme-toggle--toggled:not(label).theme-toggle .theme-toggle__expand :first-child path{d:path("M-9 3h25a1 1 0 0017 13v30H0Z");transition-delay:calc(var(--theme-toggle__expand--duration) * 0.4);transition-timing-function:cubic-bezier(0,0,0,1.25)}@supports not (d:path("")){.theme-toggle input[type=checkbox]:checked~.theme-toggle__expand :first-child path,.theme-toggle--toggled:not(label).theme-toggle .theme-toggle__expand :first-child path{transform:translate3d(-9px,14px,0)}}.theme-toggle{border:none;background:0 0;cursor:pointer}.theme-toggle input[type=checkbox]{display:none}.theme-toggle .theme-toggle-sr{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}@media (prefers-reduced-motion:reduce){.theme-toggle:not(.theme-toggle--force-motion) *{transition:none!important}}
      </style>
      <button
        class="theme-toggle"
        type="button"
        title="Toggle theme"
        aria-label="Toggle theme"
        onclick="themeToggle_click()"
      >
        <svg
          xmlns="http://www.w3.org/2000/svg"
          aria-hidden="true"
          width="1em"
          height="1em"
          fill="currentColor"
          class="theme-toggle__expand"
          viewBox="0 0 32 32"
        >
          <clipPath id="theme-toggle__expand__cutout">
            <path d="M0-11h25a1 1 0 0017 13v30H0Z" />
          </clipPath>
          <g clip-path="url(#theme-toggle__expand__cutout)">
            <circle cx="16" cy="16" r="8.4" />
            <path d="M18.3 3.2c0 1.3-1 2.3-2.3 2.3s-2.3-1-2.3-2.3S14.7.9 16 .9s2.3 1 2.3 2.3zm-4.6 25.6c0-1.3 1-2.3 2.3-2.3s2.3 1 2.3 2.3-1 2.3-2.3 2.3-2.3-1-2.3-2.3zm15.1-10.5c-1.3 0-2.3-1-2.3-2.3s1-2.3 2.3-2.3 2.3 1 2.3 2.3-1 2.3-2.3 2.3zM3.2 13.7c1.3 0 2.3 1 2.3 2.3s-1 2.3-2.3 2.3S.9 17.3.9 16s1-2.3 2.3-2.3zm5.8-7C9 7.9 7.9 9 6.7 9S4.4 8 4.4 6.7s1-2.3 2.3-2.3S9 5.4 9 6.7zm16.3 21c-1.3 0-2.3-1-2.3-2.3s1-2.3 2.3-2.3 2.3 1 2.3 2.3-1 2.3-2.3 2.3zm2.4-21c0 1.3-1 2.3-2.3 2.3S23 7.9 23 6.7s1-2.3 2.3-2.3 2.4 1 2.4 2.3zM6.7 23C8 23 9 24 9 25.3s-1 2.3-2.3 2.3-2.3-1-2.3-2.3 1-2.3 2.3-2.3z" />
          </g>
        </svg>
      </button>
      <script >
      if (typeof window.localStorage !== "undefined" && window.localStorage.getItem("prefersTheme") !== null) {
        var theme = window.localStorage.getItem("prefersTheme");
        if (theme == "dark") {
          document.querySelector(".theme-toggle")?.classList.add("theme-toggle--toggled");
        }
        document.querySelector("html").setAttribute("data-theme", theme);
      } else if (window.matchMedia("(prefers-color-scheme: dark)").matches) {
        document.querySelector(".theme-toggle")?.classList.add("theme-toggle--toggled");
      }
      
      function themeToggle_click() {
        document.querySelector('.theme-toggle').style.setProperty('--theme-toggle__expand--duration', '500ms');
        document.querySelector(".theme-toggle")?.classList.toggle("theme-toggle--toggled");
        var theme = document.querySelector(".theme-toggle").classList.contains("theme-toggle--toggled") ? "dark" : "light";
        document.querySelector("html").setAttribute("data-theme", theme);
        if (window.localStorage !== "undefined") {
          window.localStorage.setItem("prefersTheme", theme);
        }
      }
      </script>

  </ul>
</nav>