swhitty / SwiftDraw

Swift library and command line tool to convert SVGs into SFSymbol, PNG, PDF and Swift source code.
zlib License
386 stars 48 forks source link

Autogenerate variants with Command Line Tool #38

Open paul-brenner opened 6 months ago

paul-brenner commented 6 months ago

I was converting some svgs using the command line tool that don't have variants. But it was reasonable enough for me to create copies of the original where stroke-width="2" and create a version with stroke-width="1" for ultralight and stroke-width="4" for black.

I'm assuming there may be a good reason why the tool doesn't automatically offer the ability to do that for me? Is it just "no one else wants that so it wasn't work building", "you will really regret it if you try to write a prerun script that generates variants with .5 and 2x the stroke-width and tries to use those for variants", or "sure, maybe that can be added in a future version if time ever allows"?

Sorry for the naive question, love the tool, and thank you!

swhitty commented 4 months ago

Hi @paul-brenner,

This could be a useful option to add to the command line tool but it shouldn't be the default. There is a little complexity because some SVGs are scaled, so a stroke-width may need to be relative, or we supply it as a % e.g:

--ultralight-stroke-width=75% ?