Dynamic Logos on Scroll: How to Master Your Dawn Theme Header
Hey store owners! Ever landed on a website where the logo subtly changes as you scroll down, or when you interact with the navigation? It's a fantastic little detail that adds a touch of polish and professionalism to your online store. It's also a common request in the Shopify community, and recently, a discussion popped up about doing exactly this with the popular Dawn theme. I wanted to dive into that thread and share the insights, especially a really clever solution that emerged!
Our friend RebekkaBavnild kicked off the discussion, asking how to make her white logo (which looks great at the top of a hero section) switch to a burgundy/red version once a visitor scrolls down the homepage or navigates to another page. Essentially, she wanted that crisp white logo only when someone was at the very top of the homepage. A very specific and common design need, especially when your header background changes!
Community Insights: Two Paths to a Dynamic Logo
As often happens in our vibrant community, a couple of approaches came up. One involved a more direct "image swap" method, while another offered a super neat trick using CSS filters. Let's break down what we learned and why one stood out for its simplicity and effectiveness.
The "No Theme Code Edit" CSS Filter Trick
One of our resident experts, tim_tairli, jumped in with a solution that's quite elegant because it avoids directly editing your theme's core code. Why is this a big deal? Well, as tim_tairli rightly pointed out, avoiding theme code edits makes future theme updates much easier and less prone to breaking your customizations. This is gold for busy store owners who want to keep their stores up-to-date without constant re-coding!
Instead of meticulously swapping out two different image files (a white one and a red one) in your theme's Liquid files, this method uses CSS to dynamically change the appearance of a single logo. Here's the genius behind it:
- You upload your darker logo (in Rebekka's case, the burgundy/red one) as your primary logo in the theme customizer.
- Then, you use a special CSS rule to "brighten" that logo to white when the page is at the very top and not scrolled. The Dawn theme conveniently adds a
.scrolled-past-headerclass to your header when you scroll, which makes this detection easy.
How to Implement the CSS Filter Solution in Dawn Theme:
This method focuses on the homepage, where you often have a hero section that might require a lighter logo against a dark background, then want it to revert to a standard color on scroll.
- Set Your Logo: Go to your Shopify Admin > Online Store > Themes > Customize. Under your "Header" settings, upload your darker version of the logo (e.g., your burgundy/red logo). This will be your default.
- Add a Custom Liquid Section: Navigate to your homepage in the theme customizer. Scroll to the very bottom of your "Template" area. Click "Add section" and choose "Custom liquid". This section is perfect because its content only renders on the specific page it's added to (in this case, your homepage).
- Paste the Initial CSS Code: In the "Custom liquid" section, paste the following code. This CSS targets the logo within the header. The
:not(.scrolled-past-header)part means "apply these styles ONLY if the header does NOT have thescrolled-past-headerclass" (i.e., when you're at the top of the page). Thefilter: brightness(10);property will make a dark logo appear very bright, effectively turning it white.
Rebekka tried this, and she confirmed, "WOW you are the best. It worked perfectly !! THANK YOU." The red logo would appear white at the top of the homepage and switch to red once scrolled. Success!
Refinement: Handling Dropdown Menus Too!
Rebekka had a brilliant follow-up question: "Is it possible to trigger the color change when the 'SHOP' dropdown menu is opened/hovered also?" This is a smart consideration, as an open menu (which might have a light background) could obscure a light logo, making it hard to see.
tim_tairli quickly provided an update to the code to handle this scenario. The extended code ensures that the logo brightens up (stays white) only if the header is not scrolled AND there isn't an open submenu or mobile menu drawer. This uses the powerful :has() pseudo-class, which is a modern CSS feature that allows you to select an element based on whether it contains certain children.
Updated Code for Scroll and Dropdown Menu Awareness:
Replace the previous CSS in your "Custom liquid" section with this updated version:
.section-header:not(
.scrolled-past-header,
:has([open="true"], .menu-drawer-container[open])
) .header__heading-logo {
filter: brightness(10);
}
This tiny but powerful piece of CSS makes your header even more responsive and user-friendly. It's a fantastic example of how a small tweak, leveraging existing theme classes and modern CSS, can significantly improve the user experience without deep theme file modifications.
What About a "True" Image Swap?
Another community member, Moeed, offered a solution that aimed for a more traditional image swap, where you'd actually hide one logo image and show another based on scroll. While a true image swap can be ideal if your logos are entirely different designs (not just color variations, but perhaps different layouts or elements), it generally requires editing your theme's core Liquid files (like sections/header.liquid or a similar snippet) to include both logo images in the HTML with specific classes (e.g., logo-red, logo-white).
Moeed provided the CSS to handle the showing and hiding once those two images are in place and properly classed:
However, Rebekka found this approach didn't work for her, stating, "Nothing changed unfortunately." This was likely because the crucial prerequisite step of modifying the HTML to include both images with the correct classes was missing from the instructions. This highlights why solutions that minimize direct theme file edits, like tim_tairli's filter method, are often preferred for their simplicity and reduced risk, especially for a common color-change requirement.
The images provided by Moeed visually demonstrate the desired effect of a logo swap:
So, there you have it! If you're looking to add that cool logo-on-scroll effect to your Dawn theme, especially a color change, the CSS filter method is a fantastic starting point. It's less intrusive, easier to maintain, and as Rebekka found, it really does work! Always remember to test any code changes in a duplicate theme first, just to be safe. It's awesome to see our community members helping each other out with these kinds of clever solutions. Happy customizing!

