Skip to content

Commit

Permalink
TEST: Add color switcher to index page
Browse files Browse the repository at this point in the history
Copied from:
https://squidfunk.github.io/mkdocs-material/setup/changing-the-colors/

The objective is to test different color schemes for Hedgehog docs.
  • Loading branch information
qmonnet committed Nov 29, 2024
1 parent 43bb9d2 commit bdf83b2
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,27 @@ documentation.

You can find out how to [download](getting-started/download.md) and try the Fabric on the self-hosted
[fully virtualized lab](vlab/overview.md) or on [hardware](install-upgrade/install.md).


Click on a tile to change the color scheme:

<div class="mdx-switch">
<button data-md-color-scheme="default"><code>default</code></button>
<button data-md-color-scheme="slate"><code>slate</code></button>
</div>

<script>
var buttons = document.querySelectorAll("button[data-md-color-scheme]")
buttons.forEach(function(button) {
button.addEventListener("click", function() {
document.body.setAttribute("data-md-color-switching", "")
var attr = this.getAttribute("data-md-color-scheme")
document.body.setAttribute("data-md-color-scheme", attr)
var name = document.querySelector("#__code_0 code span.l")
name.textContent = attr
setTimeout(function() {
document.body.removeAttribute("data-md-color-switching")
})
})
})
</script>

0 comments on commit bdf83b2

Please sign in to comment.