Skip to content

Commit bdf83b2

Browse files
committed
TEST: Add color switcher to index page
Copied from: https://squidfunk.github.io/mkdocs-material/setup/changing-the-colors/ The objective is to test different color schemes for Hedgehog docs.
1 parent 43bb9d2 commit bdf83b2

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

docs/index.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,27 @@ documentation.
1212

1313
You can find out how to [download](getting-started/download.md) and try the Fabric on the self-hosted
1414
[fully virtualized lab](vlab/overview.md) or on [hardware](install-upgrade/install.md).
15+
16+
17+
Click on a tile to change the color scheme:
18+
19+
<div class="mdx-switch">
20+
<button data-md-color-scheme="default"><code>default</code></button>
21+
<button data-md-color-scheme="slate"><code>slate</code></button>
22+
</div>
23+
24+
<script>
25+
var buttons = document.querySelectorAll("button[data-md-color-scheme]")
26+
buttons.forEach(function(button) {
27+
button.addEventListener("click", function() {
28+
document.body.setAttribute("data-md-color-switching", "")
29+
var attr = this.getAttribute("data-md-color-scheme")
30+
document.body.setAttribute("data-md-color-scheme", attr)
31+
var name = document.querySelector("#__code_0 code span.l")
32+
name.textContent = attr
33+
setTimeout(function() {
34+
document.body.removeAttribute("data-md-color-switching")
35+
})
36+
})
37+
})
38+
</script>

0 commit comments

Comments
 (0)