Custom Header

To get you close, you’d be looking at something more along the lines of this:

{% set post = 'd' if is_state('sun.sun', 'above_horizon') else 'n' %}
<img src='/local/icons/yr/{{ states.sensor.yr_symbol.state }}{{ post }}.svg'>

You’ll probably have to add some styling to the image element.

These types of posts belong here:

https://community.home-assistant.io/t/custom-header-template-showcase-and-discussion