A lightweight TypeScript library providing essential file type icons, similar to vscode-icons but with a curated set of the most commonly used icons.
- 🎯 Essential Icons Only: Curated set of 48 most commonly used file type icons
- 📦 Lightweight: Reduced from 1400+ to 48 icons (96.6% size reduction)
- 🔧 TypeScript: Full TypeScript support with type definitions
- 🌐 ES Modules: Modern ES module support only
- 📁 Complete API: Same interface as vscode-icons for easy migration
npm install electerm-iconsimport {
getIconForFile,
getIconForFolder
} from 'electerm-icons';
// Get icon for files
console.log(getIconForFile('index.html')); // 'file_type_html.svg'
console.log(getIconForFile('script.js')); // 'file_type_js.svg'
console.log(getIconForFile('main.py')); // 'file_type_python.svg'
console.log(getIconForFile('unknown.xyz')); // 'default_file.svg'
// Get icon for folders
console.log(getIconForFolder('src')); // 'default_folder.svg'- HTML:
.html,.htm,.xhtml - CSS:
.css,.scss,.sass,.less - JavaScript:
.js,.mjs,.cjs - TypeScript:
.ts,.tsx - JSON:
.json,.jsonc - XML:
.xml,.xsd,.xsl
- Python:
.py,.pyw,.pyc,.pyo - Java:
.java,.class,.jar - C/C++:
.c,.h,.cpp,.cxx,.cc,.hpp,.hxx - C#:
.cs,.csx - PHP:
.php,.phtml,.php3,.php4,.php5 - Go:
.go - Rust:
.rs,.rlib - Ruby:
.rb,.erb,.gemspec - Swift:
.swift - Kotlin:
.kt,.kts
- YAML:
.yaml,.yml - TOML:
.toml - INI:
.ini,.cfg,.conf - SQL:
.sql,.mysql,.pgsql
- Markdown:
.md,.markdown,.mdown
package.json,package-lock.json.gitignore,.gitattributesDockerfile,docker-compose.ymlCMakeLists.txt,MakefileLICENSE,README.md
Returns the appropriate icon filename for a given file.
Returns the appropriate icon filename for a folder.
DEFAULT_FILE: Default file iconDEFAULT_FOLDER: Default folder icon
| Library | Icons | Size | Use Case |
|---|---|---|---|
| vscode-icons | 1400+ | 7.7MB | Full IDE support |
| electerm-icons | 48 | ~0.14MB | Essential files only |
electerm-icons provides the same API as vscode-icons, making migration simple:
// Before (vscode-icons)
import { getIconForFile } from 'vscode-icons-js';
// After (electerm-icons)
import { getIconForFile } from 'electerm-icons';
// Same function calls work identically
const icon = getIconForFile('index.html');# Build the library
npm run build
# Run tests
npm test
# Development with watch mode
npm run devMIT © ZHAO Xudong
All icons in this project are sourced from vscode-icons, licensed under the MIT License.
Copyright (c) 2016-present Roberto Huertas
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.