Description
Without AMP, a dark mode version of an image can be set via <source> like this:
<picture>
<source srcset="/dark-image.png" media="(prefers-color-scheme: dark)" />
<img src="/image.png" width="100" height="100" />
</picture>
However, the amp-img component doesn't seem to have an option like that right now.
Maybe it could work in a similar way to the fallback image:
<!-- Proposal -->
<amp-img alt="Image"
width="100" height="100"
src="/image.png"
>
<amp-img alt="Image"
dark
width="100" height="100"
src="/dark-image.png"
></amp-img>
</amp-img>
Alternatives Considered
Allow media to work like this:
<!-- Alternative proposal with media -->
<amp-img alt="Image"
width="100" height="100"
src="/image.png"
>
<amp-img alt="Image"
media="(prefers-color-scheme: dark)"
width="100" height="100"
src="/dark-image.png"
></amp-img>
</amp-img>
Additional Context
No response
Description
Without AMP, a dark mode version of an image can be set via
<source>like this:However, the
amp-imgcomponent doesn't seem to have an option like that right now.Maybe it could work in a similar way to the fallback image:
Alternatives Considered
Allow
mediato work like this:Additional Context
No response