Add Option To Hide Color Scheme Toggle (#406)

* Add color scheme toggle

Add hidedarkmodetoggle to exampleSite, stackbit

Change property name to hidecolorscheme toggle

* Add my name to CONTRIBUTORS.md
This commit is contained in:
Joseph Sanders
2020-09-29 17:32:00 -04:00
committed by GitHub
parent 6c97691f5e
commit 6302a4b82b
4 changed files with 16 additions and 6 deletions

View File

@@ -77,3 +77,4 @@
- [Jared Sturdy](https://github.com/jsturdy) - [Jared Sturdy](https://github.com/jsturdy)
- [Daniel Monteiro](https://github.com/dfamonteiro) - [Daniel Monteiro](https://github.com/dfamonteiro)
- [Dave Rolsky](https://github.com/autarch) - [Dave Rolsky](https://github.com/autarch)
- [Joseph Sanders](https://github.com/jls83)

View File

@@ -42,6 +42,9 @@ disqusShortname = "yourdiscussshortname"
# "light" (light background, dark foreground) (default) # "light" (light background, dark foreground) (default)
colorscheme = "auto" colorscheme = "auto"
# Hide the toggle button, along with the associated vertical divider
hidecolorschemetoggle = false
# Series see also post count # Series see also post count
maxSeeAlsoItems = 5 maxSeeAlsoItems = 5

View File

@@ -4,9 +4,11 @@
{{ .Site.Title }} {{ .Site.Title }}
</a> </a>
{{ if or .Site.Menus.main .Site.IsMultiLingual }} {{ if or .Site.Menus.main .Site.IsMultiLingual }}
<span id="dark-mode-toggle" class="float-right"> {{ if not .Site.Params.hidecolorschemetoggle }}
<i class="fa fa-adjust fa-fw" aria-hidden="true"></i> <span id="dark-mode-toggle" class="float-right">
</span> <i class="fa fa-adjust fa-fw" aria-hidden="true"></i>
</span>
{{ end }}
<input type="checkbox" id="menu-toggle" /> <input type="checkbox" id="menu-toggle" />
<label class="menu-button float-right" for="menu-toggle"> <label class="menu-button float-right" for="menu-toggle">
<i class="fa fa-bars fa-fw" aria-hidden="true"></i> <i class="fa fa-bars fa-fw" aria-hidden="true"></i>
@@ -36,9 +38,11 @@
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ end }} {{ end }}
<li class="navigation-item separator"> {{ if not .Site.Params.hidecolorschemetoggle }}
<span>|</span> <li class="navigation-item separator">
</li> <span>|</span>
</li>
{{ end }}
</ul> </ul>
{{ end }} {{ end }}
</section> </section>

View File

@@ -66,6 +66,8 @@ models:
name: hideCredits name: hideCredits
- type: boolean - type: boolean
name: hideCopyright name: hideCopyright
- type: boolean
name: hidecolorschemetoggle
- type: number - type: number
name: since name: since
- type: string - type: string