Is there a way to set a different background image every 24 hours?

Hey all,

Been working on my pretty custom dashboard, and looking to see if this is possible:

I want to set my background image differently every 24 hours (i.e. at midnight it changes).

My YAML code in the theme file for setting the background is just this:

      # Backgrounds
      lovelace-background: 'center / cover no-repeat url("/local/images/backgrounds/light/mountain.jpg") fixed'

      # Backgrounds
      lovelace-background: 'center / cover no-repeat url("/local/images/backgrounds/dark/ferns.jpg") fixed'

That makes it look like this:

Now, the folder these are stored in have multiple images that I want to set them to:

/local/images/backgrounds/light/ has leaves.jpg, lighthouse.jpg and mountain.jpg
/local/images/backgrounds/dark/ has only ferns.jpg right now, but will be adding more.


I really want to keep it aligned with the device theme, rather than using automations to change it when the sun goes down (because if I’m abroad, it won’t match my phone’s theme, which goes by the sunrise/sunset).

Any ideas?

P.S. by the way, if anyone has a way to match the primary colours in the theme (currently light blue, as seen in the navbar buttons) with the device colour palette, please do let me know. It’d really be the cherry on top for this dashboard :grin:

EDIT: Crossposted on Reddit: