Bi0T1N / typst-iconic-salmon-svg

A Typst library for Social Media references with icons based on scalable vector graphic (SVG).
MIT License
1 stars 0 forks source link

Consider making icons accessible without the mandatory name/URL etc. #2

Open Andrew15-5 opened 3 weeks ago

Andrew15-5 commented 3 weeks ago

I was looking for a package that provides icons for popular platforms, but the https://typst.app/universe/package/fontawesome only support black and white versions, while this package requires a name. It probably has a different usage in mind, but from the package name it feels like it should also give the full control to the user and allow using the icons separately from the link generator function.

As a workaround, I had to grab the package directory and copy the svg subdirectory to my project. Then I added a few variables for the needed icons and after imported them locally. Here is my use case:

#let logo(file) = box(image(file, height: 0.7em))
#let discord = logo("./svg/Discord_icon_clyde_blurple_RGB.svg")
#let instagram = logo("./svg/Instagram_logo_2022.svg")
#let linkedin = logo("./svg/LinkedIn_icon.svg")
#let mastodon = logo("./svg/Mastodon_logo_purple.svg")
#let twitter = logo("./svg/Logo_of_Twitter.svg")
#let x = logo("./svg/X_logo_2023.svg")
#let youtube = logo("./svg/YouTube_full-color_icon_(2017).svg")

My local copy includes ./icons/svg/*.svg and ./icons/icons.typ. Then I can import all the variables directly:

#import "./icons/icons.typ": *
#mastodon

Or make an icon module:

#import "./icons/icons.typ" as icon
#icon.mastodon

BTW, I used the Mastodon logo from https://joinmastodon.org/logos/logo-purple.svg (https://joinmastodon.org/branding).

Bi0T1N commented 2 weeks ago

I was looking for a package that provides icons for popular platforms, but the https://typst.app/universe/package/fontawesome only support black and white versions, while this package requires a name. It probably has a different usage in mind, but from the package name it feels like it should also give the full control to the user and allow using the icons separately from the link generator function.

To be honest I really didn't had the use-case of using the icons separately in mind when I created this package but I think it's a legitimate suggestion and shouldn't be that complicated to implement. :smiley: