eleventy-img and prefers-color-scheme #3746
Replies: 1 comment
-
You should be able to create a shortcode to accomplish that. I've looked at 11ty-image, and it's changed a lot since I first added it to my site. (TODO for me, update my code!) I'm using an older method, an aync shortcode. I've adapted it to light and dark mode.
You'll have to adjust directories for your configuration/setup. Assuming your screenshots are in Then, in a template, use your shortcode:
It will generate the responsive images with the media query you specified. N.B. the shortcode produces the code that (I think) you want. But I have no experience with Demo available in this repo: https://github.com/btrem/11ty_3746 |
Beta Was this translation helpful? Give feedback.
-
I have a screenshot that I want to show in light or dark mode; without eleventy-img this is the markup I want to have:
Is there a way to generate the
prefers-color-scheme
options while maintaining the eleventy-img size and format variations?Beta Was this translation helpful? Give feedback.
All reactions