# Serve different image regarding the color scheme

**URL:** <https://forum.ghost.org/t/serve-different-image-regarding-the-color-scheme/14001>\
**Category:** Themes\
**Created:** [May 1, 2020, 2:08pm UTC](https://forum.ghost.org/t/serve-different-image-regarding-the-color-scheme/14001 "2020-05-01T14:08:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![escudero](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/escudero/32/7648_2.png) [@escudero](https://forum.ghost.org/u/escudero)\
**Post date:** [May 1, 2020, 2:08pm UTC](https://forum.ghost.org/t/serve-different-image-regarding-the-color-scheme/14001/1 "2020-05-01T14:08:27Z")

</div>

Is there a built in function to serve an image for light mode and another image for dark mode? Or any hint in how to approach this? I’m using casper theme.

---

<div class="post-metadata">

**Author:** ![DavidDarnes](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/daviddarnes/32/3533_2.png) [@DavidDarnes](https://forum.ghost.org/u/DavidDarnes)\
**Post date:** [May 1, 2020, 3:20pm UTC](https://forum.ghost.org/t/serve-different-image-regarding-the-color-scheme/14001/2 "2020-05-01T15:20:31Z")

</div>

Interesting question @escudero. “Dark mode” in Casper is done using CSS and uses the [`prefers-color-scheme: dark` media query](https://css-tricks.com/dark-modes-with-css/). So you could use some custom CSS to optionally show and hide graphics on the page and wrap the “dark mode” CSS in that media query.

Is this for a single post or for the home page? You could apply the image directly into the theme, or if this is for all posts then maybe utilising a meta field for the dark image is an option.

I’d be interested to know about your use case 😊

---

<div class="post-metadata">

**Author:** ![escudero](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/escudero/32/7648_2.png) [@escudero](https://forum.ghost.org/u/escudero)\
**Post date:** [May 3, 2020, 12:03pm UTC](https://forum.ghost.org/t/serve-different-image-regarding-the-color-scheme/14001/3 "2020-05-03T12:03:08Z")

</div>

> [@DavidDarnes](#):
>
> prefers-color-scheme

@DavidDarnes what comes to my mind right now is replacing `<img>` with `<picture>` in the `index.hbs` for example, where I want to switch the banner.

What’s stopping me right now is that I don’t really know how to upload a second “banner image”, can you point me in the right direction?

---

<div class="post-metadata">

**Author:** ![DavidDarnes](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/daviddarnes/32/3533_2.png) [@DavidDarnes](https://forum.ghost.org/u/DavidDarnes)\
**Post date:** [May 4, 2020, 1:23pm UTC](https://forum.ghost.org/t/serve-different-image-regarding-the-color-scheme/14001/4 "2020-05-04T13:23:15Z")

</div>

There’s a couple of ways to achieve this:

- Utilise the alternative meta images in post settings. Ghost allows you to upload feature images for both Twitter and Facebook, you could use these fields to upload an alternative image and access it using `{{post.twitter_image}}` or `{{post.og_image}}` respectively
- Add an image to the start of the post content, hide it with CSS but use JavaScript to transpose it into the element you’d like it to appear in

Would I be assuming correctly that you’re looking to have the feature image change when someone is using a dark colour scheme?
