kennethcachia / background-check

Automatically switch to a darker or a lighter version of an element depending on the brightness of images behind it.
http://kennethcachia.com/background-check/
MIT License
3.27k stars 282 forks source link

Support for SVG Graphics #50

Closed ghost closed 9 years ago

ghost commented 9 years ago

Would be great to add support for svg graphics, so the script is also looking at "image-tags".

<image xlink:href="path/to/img" src="path/to/fallback/img"></image>
kennethcachia commented 9 years ago

Interesting... I'll mark this as a enhancement.

Thanks!

isaacalves commented 9 years ago

I got it working with SVG using this method.

Here's the Sass:

.logo {
  color: black;
  &.background--light { fill: black; }
  &.background--dark { fill: white; }
  & svg { fill: currentColor; }
}

with the SVG inline wrapped inside div.logo

ghost commented 9 years ago

Hi, very nice. :-) Thanks!