You want your logo to automatically change (invert) its color to maintain visibility on light or dark backgrounds in Webflow.
1. Use Two Versions of the Logo
- Create and upload two versions of your logo: one light version (for dark backgrounds) and one dark version (for light backgrounds).
- Upload these logos to the Webflow Assets panel.
2. Set Up Conditional Visibility Using Classes
- Place both logos inside the same parent container (like a
div
) in the Webflow Designer. - Assign each logo its own class, for example: logo--light and logo--dark.
- Set the initial display setting to one of the logos (e.g.,
block
) and the other to display: none
.
3. Use Custom CSS or Webflow Interactions
- If the logo's background changes based on section color, you can use Webflow Interactions (page or scroll-triggered) to toggle which logo is visible.
- Alternatively, use Custom CSS that detects classes on the parent section and adjusts logo visibility:
- For example, if a section has the class dark-background:
- Use custom CSS in Page Settings > Custom Code > Inside :
.dark-background .logo--light { display: none; } .dark-background .logo--dark { display: block; }
4. Optional: Use CSS Filter for Inversion
- For simple logos (like black SVGs), you can use the CSS
filter: invert(1)
to invert colors: - Add a combo class to your logo element like logo invert.
- In Designer Style Panel, set a CSS filter:
invert(100%)
. - Toggle the
invert
class dynamically via interactions or depending on the parent section.
5. Use Light/Dark Mode Detection (Advanced)
- If the background color changes based on the user’s OS light/dark mode setting, use the
prefers-color-scheme
media query: - Add this to Page Settings > Custom Code:
``
Summary
Use two logo versions (light and dark), then control which one is shown with CSS visibility, Webflow Interactions, or media queries depending on the background color or user theme. Alternatively, use filter: invert(1)
for simple monochrome logos.