-
Notifications
You must be signed in to change notification settings - Fork 12.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request: Custom Icon API #13079
Comments
Instead of a JSON, there could be a function for adding a javascript object or array of objects. |
Hi there, technically you are able to add custom icon definitions by using the library.
see also here. But in most cases people have nice svg files and unfortunateley there is no way to add new icons based on the svg data, so we yet have to create this array by hand (which is then used to create an svg tag). Another problem is, that this array only supports one path, but my svg files have multiple paths. Does anybody found a solution to this? |
Maybe you could concat the |
@Fensterbank can that be done even if I'm including the FontAwesome scripts the old fashioned way (i.e. not importing them with NPM)? Last time I tried using |
Oh! Just figured out how to do this! window.FontAwesome.library.add({
faMyCustomIcon: {
iconName: "custom-icon",
prefix: "fac",
icon: [
260, // viewBox width
260, // viewBox height
[], // ligatures
"f269", // unicode codepoint - private use area
"M27.827, ..., 162.278Z", // path
]
}
}); To use it:
This is great, going to be very useful going forward! |
@Fensterbank I assume there are other programs that will do something similar too. |
As far as I can tell, this doesn't work properly with Angular due to typescript typings for icon definitions. See #14199 |
@shaedrich @rooby Thank you for your suggestions. |
This package https://www.npmjs.com/package/oslllo-svg-fixer helped me to batch process number of SVGs from multi-path to single path by specifying |
Sometimes my designers don't use Font Awesome and I'm stuck either substituting what they've got with Font Awesome icons or integrating their custom icons in addition to Font Awesome. It'd be nice to be able to specify a JSON path or something that contained custom icon definitions. Something like:
The text was updated successfully, but these errors were encountered: