How to change SVG colors

thank you so much for the in-depth explanation!

1 Like

Just dropping this here.

I find it a much better SVG coloring approach than the inline embedded SVG paths.

Any way to change the svg paths color separately? If I use CurrentColor I can set just one color for all svg paths. Thanks!

The filter effect approach colors the whole thing with no ability to separate parts.

With SVG inlining, you can use CurrentColor to inherit the foreground CSS color of the item and apply it to specific paths in your SVG.

But if the SVG is inline, in an HTML embed, there is nothing to stop you from embedding other colors on other paths in your SVG. You just wonā€™t get direct designer support for it. If the SVG is in a collection list, or on a Collection Page, you should be able to embed CMS colors in it too. All of this will take some work, clean SVG code, and an understanding of SVG paths and structure.

Thanks for the answer. I sorted it out just adding some css custom code:

.tabs-menu .w--current svg path, .tabs-menu .w--current svg line{
    	fill: #242420;
      	stroke: #242420;
	}

That way I can have the different original svg colors and change them when the tab is current tab.

Thanks!
Miguel Gisbert

Thanks a lot!

Any idea how I can solve the character limit with the embed element?

ā€œCustom Code cannot exceed 10000 characters.ā€

@Henry_Auffahrt

My favorite way for large SVGā€™s is to convert the SVG to a Lottie.
You can then edit the JSON if you want, to add class names and currentColor to paths.

Webflow has a nice Lottie-embed component, which will allow you to upload your Lottie file to assets, and yet the finished SVG will be inlined in your page ( make sure to switch the Lottied element to SVG mode, not Canvas ).

Assets has a file size limit of 4MB, so you can have SVGs up to 400 times larger. Donā€™t abuse that, though.

1 Like

I wouldnā€™t have even thought of Lottie as a solution to this problem! Thank you for making me think of it. I will give it a try soon!

Thanks also for the resources where I can start jumping in this topic. I have not used Lottie myself before.

after uploading your svg:
Seems that if you use the media browser, and add your svg to a page, it will render the svg as an image, and youā€™ll lose customization as a result. Try adding the svg as an ā€œembedā€, you should be able to access and changes properties as expected with svgā€™s.

I had this. I think it was because my svg was detailed. Lots of letters. I tested by making a simple triangle and that was less code so it worked. I may be wrong as I havenā€™t got a clue about code. The code I got also didnā€™t have a ā€˜fillā€™ in it. Chat gpt advised me where to put it and gave me a corrected code.

Yes, itā€™s a bit complicated :sweat_smile:, but I think Iā€™ll figure it out