Change SVG Color Via Action?

Q&A about the latest versions
Post Reply
User avatar
TheRealMojoJojo
Posts: 341
Joined: Thu Sep 20, 2018 10:18 pm

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!
User avatar
Hopki
Gnome
Posts: 13005
Joined: Thu Jan 10, 2008 3:16 pm
Location: Layer de la Haye, Essex UK
Contact:

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
Garden Gnome Support
If you send an e-mail to support please send a link to the forum post for reference.
support@ggnome.com
https://ggnome.com/wiki/documentation/
User avatar
TheRealMojoJojo
Posts: 341
Joined: Thu Sep 20, 2018 10:18 pm

Hi Hopki,

Thanks for the quick response and no, I did not know that. That's good to know and thanks for sharing :-)
mbb
Posts: 276
Joined: Mon Oct 19, 2009 11:42 pm

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
User avatar
TheRealMojoJojo
Posts: 341
Joined: Thu Sep 20, 2018 10:18 pm

mbb wrote: Mon Jan 14, 2019 5:34 am 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
Very interesting stuff. It's a little outa my league but maybe someone with more coding experience can whip together a working script for us :-) Thanks for sharing!
User avatar
Tony
Posts: 1341
Joined: Mon Feb 15, 2010 6:54 am
Location: Adelaide, South Australia
Contact:

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


svg-0.jpg
svg-0.jpg (62.55 KiB) Viewed 5023 times


Tony
Tony Redhead | Panoramic Photographer | mobile: +61438501002 | website: https://tonyredhead.com - https://redsquare.com | Pano2VR Tutorials: https://tonyredhead.com/pano2vr | instagram: https://www.instagram.com/tonyredhead/
User avatar
TheRealMojoJojo
Posts: 341
Joined: Thu Sep 20, 2018 10:18 pm

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 :-)
Post Reply