Skip to content
Discussion options

You must be logged in to vote

This has been implemented in version 8.1.1 by adding a #only-light or #only-dark hash fragment to the image URL.

![Image title](https://dummyimage.com/600x400/f5f5f5/aaaaaa#only-light)
![Image title](https://dummyimage.com/600x400/21222c/d5d7e2#only-dark)

Alternatively, use prefers-color-scheme CSS media queries—instead of using the toggle switch—to enable automatic dark/light switching for images or SVG files. This has the added benefit of being framework-agnostic.

The first image will load if the system prefers a light color scheme, the second will load if it prefers dark, and the first will load as a fallback.

<picture>
  <source media="(prefers-color-scheme: light)" srcset="https://un…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by squidfunk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants