D
D
Denis Bukreev2017-02-10 00:44:26
JavaScript
Denis Bukreev, 2017-02-10 00:44:26

Is changing the color of an SVG element relative to its background color realistic?

There was a small problem - the white cross icon on the background of color images looked good, but if there was a white background under it, then it was not visible. Yes, 21st century problem #1.
We arranged a consultation with the whole studio, we decided to add a shadow.
This is a prehistory, so that it is clear where such an idea comes from.
And the idea sounded like this: on colored backgrounds, let the cross be white, and on light, close to white tones, repaint the cross in green (one of the colors of the design).
Well, I was wondering - is this even legal?
Is it possible to solve such a problem in JS?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikolay, 2017-02-10
@nickolyashka

How about using an alternative id or class for the svg already when adding stuff through the control system, make the checkbox "enable if the background is white". or when hovering, display the cross outside the picture so that it is probably visible.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question