Hi All,
Is it possible to change the colors of the SVG files with an action such as "on click"? I am doing all I can to keep the tour file sizes down so would like to simply change the color instead of creating additional graphics.
Thanks!
Change SVG Color Via Action?
Change SVG Color Via Action?
Creative expression is the Universe's only way of experiencing every configurative atomic possibility capable within a finite Universe.
- Hopki
- Gnome
- Posts: 8920
- Joined: Thu Jan 10, 2008 3:16 pm
- Location: Layer de la Haye, Essex UK
- Contact:
Re: Change SVG Color Via Action?
Hi,
You can't dynamically change the colour of an SVG but if its file size and performance you're concerned about then did you know If a graphic is under 5K then it gets coded inline with the skin.js file.
This means the loading will be far better.
Only images larger than this will get placed into the images folder.
Regards,
Hopki
You can't dynamically change the colour of an SVG but if its file size and performance you're concerned about then did you know If a graphic is under 5K then it gets coded inline with the skin.js file.
This means the loading will be far better.
Only images larger than this will get placed into the images folder.
Regards,
Hopki
Re: Change SVG Color Via Action?
Hi Hopki,
Thanks for the quick response and no, I did not know that. That's good to know and thanks for sharing
Thanks for the quick response and no, I did not know that. That's good to know and thanks for sharing

Creative expression is the Universe's only way of experiencing every configurative atomic possibility capable within a finite Universe.
Re: Change SVG Color Via Action?
Inline SVGs can be altered via javascript. Haven't had the need to do this myself yet, but here's a page on stackoverflow discussing it which may lead you to what you need?
https://stackoverflow.com/questions/987 ... javascript
https://stackoverflow.com/questions/987 ... javascript
Re: Change SVG Color Via Action?
Very interesting stuff. It's a little outa my league but maybe someone with more coding experience can whip together a working script for usmbb wrote: ↑Mon Jan 14, 2019 5:34 amInline SVGs can be altered via javascript. Haven't had the need to do this myself yet, but here's a page on stackoverflow discussing it which may lead you to what you need?
https://stackoverflow.com/questions/987 ... javascript

Creative expression is the Universe's only way of experiencing every configurative atomic possibility capable within a finite Universe.
Re: Change SVG Color Via Action?
Here's a cute little coloring script that I found online. It's implemented as an html page loaded via an iFrame in a text box. The link will take you to a page with the code.
Link: https://s3-ap-southeast-2.amazonaws.com ... index.html
Tony
Link: https://s3-ap-southeast-2.amazonaws.com ... index.html
Tony
Tony Redhead | Panoramic Photographer | mobile: +61438501002 | website: http://tonyredhead.com - http://redsquare.com | roundme: http://round.me/@tonyredhead | instagram: https://www.instagram.com/tonyredhead/
Re: Change SVG Color Via Action?
That's actually pretty cool. Thanks for sharing Tony! I'll see if I can figure out a way incorporate the concept into my tours 

Creative expression is the Universe's only way of experiencing every configurative atomic possibility capable within a finite Universe.
Who is online
Users browsing this forum: Baidu [Spider] and 19 guests