Jump to content

How do you invert logo color on specific color themes?

Recommended Posts

The logo .png I uploaded to my site is originally white. I know these can't be "adaptive" since it's an image, but I was hoping I could implement a code that can invert it automatically when the first sections color theme is selected (similar to how adaptive text works). I'm trying to refrain from using any kind of block, section, or collection ID to do this. 

I have tried this:
[data-theme-color="var(--lightest)"] .header-title-logo img,
[data-theme-color="var(--light)"] .header-title-logo img {
    filter: invert(100%);
}

I've also tried code injection and html but nothing. Hopefully Squarespace can make this more flexible in the future!

On another note, when I do use the section ID, how can I get it to only invert on the desktop and mobile, but not in mobile nav? 

https://sandbar-demo.squarespace.com/

password: demo

Thank you! 

Edited by morgantaylr
wrong link
Link to comment
  • Replies 1
  • Views 1.1k
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

#1. I see you figured it out?

#2. Suppose your code is

#header .header-mobile-logo img, #header .header-title-logo img {
    content: var(--dark-logo);
}

to apply desktop, use this code

<style>
@media screen and (min-width:992px) {
#header .header-mobile-logo img, #header .header-title-logo img {
    content: var(--dark-logo);
}
}
</style>

to apply mobile, use this CSS

<style>
  @media screen and (max-width:991px) {
  #header .header-mobile-logo img, #header .header-title-logo img {
    content: var(--dark-logo);
}
  }
</style>

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.