I am writing documentation using MkDocs and Material for MkDocs.
I would like to have an image inside index.md
that switch between two different versions when I switch from light to dark mode and vice versa.
I've found different solutions online, but none of them seems to work.
<picture>
<source srcset='img/dark.png' media='(prefers-color-scheme: dark)'>
<img src='img/light.png' alt="Docs logo">
</picture>
>>> HTML
<div class="img-toggle"></div>
>>> CSS
.img-toggle {
background: url(../img/light.png) center / cover;
}
@media (prefers-color-scheme: dark){
.img-toggle {
background: url(../img/dark.png) center / cover;
}
}
>>> I think this is just for GitHub
![Docs logo](./img/dark.png#gh-dark-mode-only)
![Docs logo](./img/light.png#gh-light-mode-only)
Maybe it's just not implemented yet.
I hope someone can help. Thank you very much!