From e37955933e333c9a975769069c51d115e5e680de Mon Sep 17 00:00:00 2001 From: rxxbyy Date: Tue, 24 Feb 2026 09:37:24 -0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20Fix=20Typer=20logo=20light/dark?= =?UTF-8?q?=20theme=20for=20GitHub=20and=20MkDocs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 7 +------ docs/en/docs/index.md | 12 +++++++++++- docs/en/docs/js/custom.js | 15 +++++++++++++++ 3 files changed, 27 insertions(+), 7 deletions(-) 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()