The you’d need to output 2 image tags and show/hide them in a similar way.
- modify config/settings_schema.json
Find
{
"type": "image_picker",
"id": "logo",
"label": "t:settings_schema.logo.settings.logo_image.label"
},
and add right below this
{
"type": "image_picker",
"id": "logo_on_transparent",
"label": "Logo for transparent header"
},
Then you should be able to select a second image in Theme settings
- Go to sections/header.liquid, find
{{ settings.logo | image_url: width: 600 | image_tag:
class: 'header__heading-logo motion-reduce',
widths: widths,
height: logo_height,
width: settings.logo_width,
alt: logo_alt,
sizes: sizes,
preload: true
}}
and add this right after:
{%- if settings.logo_on_transparent != blank -%}
{{ settings.logo_on_transparent | image_url: width: 600 | image_tag:
class: 'header__heading-logo motion-reduce',
widths: widths,
height: logo_height,
width: settings.logo_width,
alt: logo_alt,
sizes: sizes,
preload: true
}}
{%- endif -%}
- Then add these CSS rules:
.header__heading-logo:first-child {display: none;}
.header__heading-logo:last-child {display: initial;}
.scrolled-past-header .header__heading-logo:last-child {display: none;}
.scrolled-past-header .header__heading-logo:first-child {display: initial;}
If we stop here, you would see that your logo_on_transparent will show on all pages, even if there is no underlying banner below it. So it may become white-on-white (depending on your logo image – may be not an issue).
This can be avoided by modifying condition in step 2):
{%- if settings.logo_on_transparent != blank and template.name == "index" -%}
This way the code will only show logo_on_transparent on homepage.