diff --git a/README.md b/README.md index cf9b618bbe..16d149f8fe 100644 --- a/README.md +++ b/README.md @@ -128,12 +128,7 @@ There's a - - - - - + If you are building a CLI app to be used in the terminal instead of a web API, check out **Typer**. diff --git a/docs/en/docs/index.md b/docs/en/docs/index.md index 7f9d5efbf2..86a5acdd9e 100644 --- a/docs/en/docs/index.md +++ b/docs/en/docs/index.md @@ -125,7 +125,17 @@ There's a +
+ + + + Typer + + +
If you are building a CLI app to be used in the terminal instead of a web API, check out **Typer**. diff --git a/docs/en/docs/js/custom.js b/docs/en/docs/js/custom.js index be326d3029..c71e49d29f 100644 --- a/docs/en/docs/js/custom.js +++ b/docs/en/docs/js/custom.js @@ -174,10 +174,25 @@ function handleSponsorImages() { }); } +function setupThemeImages() { + new MutationObserver(() => { + const scheme = document.body.getAttribute("data-md-color-scheme"); + const isDark = scheme === "slate"; + document.querySelectorAll("picture[data-light-src][data-dark-src]").forEach((picture) => { + const src = isDark ? picture.dataset.darkSrc : picture.dataset.lightSrc; + const source = picture.querySelector("source"); + const img = picture.querySelector("img"); + if (source) source.srcset = src; + if (img) img.src = src; + }); + }).observe(document.body, { attributes: true, attributeFilter: ["data-md-color-scheme"] }); +} + async function main() { setupTermynal(); showRandomAnnouncement('announce-left', 5000) handleSponsorImages(); + setupThemeImages(); } document$.subscribe(() => { main()