Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Change svg color depending on the background color/image

Participant ,
Dec 09, 2016 Dec 09, 2016

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

2.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 09, 2016 Dec 09, 2016

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Dec 09, 2016 Dec 09, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Dec 09, 2016 Dec 09, 2016
LATEST

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines