Skip to main content
Alex_roo
Participant
December 9, 2016
Question

Change svg color depending on the background color/image

  • December 9, 2016
  • 3 replies
  • 2249 views

Hi All,

I have done a lot of searching but I cannot seem to find a definitive answer.

I have my logo as a black svg but when my logo rolls over the top of a complicated image I would like it to turn white and and then back to black on light backgrounds.

I hope this is enough information to go off.

Cheers,

Alex

This topic has been closed for replies.

3 replies

Alex_roo
Alex_rooAuthor
Participant
December 9, 2016

Thanks all,

So my logo is fixed at the top left corner of the site. So it is originally black but some of the images that scroll behind it are dark so it cannot be seen hence why I want to turn it white in this situation. But then there are white backgrounds too so the logo will need to be black to be seen here.

Is this a better explanation? I have had a quick look for an example but i cannot find one at the moment.

Cheers

Rob Hecker2
Legend
December 9, 2016

Placing your SVG as a symbol instance will allow you to control some aspects of it with CSS, such as rollover color. Placing the SVG within an IMG tag will not respond to the rollover state.

Jon Fritz
Community Expert
Community Expert
December 9, 2016

What are you using to control which image shows in the background?