Add dark- and light-mode image modifiers for custom MkDocs themes (#5318)

## Summary

Roughly following the docs
[here](https://squidfunk.github.io/mkdocs-material/reference/images/#custom-light-scheme).

Closes #5311.
This commit is contained in:
Charlie Marsh 2023-06-22 16:11:38 -04:00 committed by GitHub
parent e0e1d13d9f
commit 50f0edd2cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -64,3 +64,23 @@
--md-typeset-table-color: hsla(0, 0%, 100%, 0.12);
--md-typeset-table-color--light: hsla(0, 0%, 100%, 0.035);
}
[data-md-color-scheme="astral-light"] img[src$="#only-dark"],
[data-md-color-scheme="astral-light"] img[src$="#gh-dark-mode-only"] {
display: none; /* Hide dark images in light mode */
}
[data-md-color-scheme="astral-light"] img[src$="#only-light"],
[data-md-color-scheme="astral-light"] img[src$="#gh-light-mode-only"] {
display: inline; /* Show light images in light mode */
}
[data-md-color-scheme="astral-dark"] img[src$="#only-light"],
[data-md-color-scheme="astral-dark"] img[src$="#gh-light-mode-only"] {
display: none; /* Hide light images in dark mode */
}
[data-md-color-scheme="astral-dark"] img[src$="#only-dark"],
[data-md-color-scheme="astral-dark"] img[src$="#gh-dark-mode-only"] {
display: inline; /* Show dark images in dark mode */
}