Skip to content
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

Default icon #9

Open
ghost opened this issue Jan 30, 2019 · 3 comments
Open

Default icon #9

ghost opened this issue Jan 30, 2019 · 3 comments

Comments

@ghost
Copy link

ghost commented Jan 30, 2019

if an icon doesn't exist is there a way to show a default one for an extension not recognized?

kind regards

@milezzz
Copy link

milezzz commented Feb 7, 2019

Same question! You mention it briefly in readme but I need an example.

@Miosame
Copy link

Miosame commented Jul 14, 2021

For anyone still wondering, the readme pretty much tells you what you can do, each of the sets has a catalog: https://github.com/dmhendricks/file-icon-vectors/blob/master/dist/icons/high-contrast/catalog.json said catalog contains an array of all file-extensions, you have multiple ways of including it:

  • webrequest a githack'd version of the catalog you want
  • hard-code copy paste the catalog array of your icon set(s) into your code
  • embed it via external script tag, but then you'd have to give the script tag a unique identifier in the DOM to be able to access the contents and flush them into a variable

either way you choose, you can then simply check if the catalog array contains the file extension you are requesting, if not, fallback to a default e.g. the txt svg-icon is pretty universal.

@zoffixznet
Copy link

to a default

FWIW, the set does include the default icon, default.svg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants