Is there a guide on how to create new (custom) .svg icons for Swift? Just like the ones allready in DW/Swift, that automatilly adapts the line color from the theme. Our design partner tried to make som new ones, but we can't get them to adabt the line color. I have tried to search the forum without any luck.
Developer forum
E-mail notifications
Creating new svg icons
Timo Kofod
Replies
Nicolai Pedersen
Posted on 16/04/2024 23:32:58
This post has been marked as an answer
Hi Timo
We have no such guide. But it has to do with the color set inside the svg file - you have to set the stroke attribute to currentColor - see https://stackoverflow.design/product/base/current-color/
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="feather feather-gift"> <polyline points="20 12 20 22 4 22 4 12"></polyline> <rect x="2" y="7" width="20" height="5"></rect> <line x1="12" y1="22" x2="12" y2="7"></line> <path d="M12 7H7.5a2.5 2.5 0 0 1 0-5C11 2 12 7 12 7z"></path> <path d="M12 7h4.5a2.5 2.5 0 0 0 0-5C13 2 12 7 12 7z"></path> </svg>
Also there can be other attribnutes in SVGs created in other tools - some attributes might need to be removed.
Votes for this answer: 1
Timo Kofod
Posted on 17/04/2024 08:35:55
Great. Thanks, Nicolai 😊
You must be logged in to post in the forum