https://github.com/electerm/electerm-icons
A lightweight TypeScript library providing essential file type icons, similar to vscode-icons but with a curated set of the most commonly used icons.
https://github.com/electerm/electerm-icons
Last synced: 7 months ago
JSON representation
A lightweight TypeScript library providing essential file type icons, similar to vscode-icons but with a curated set of the most commonly used icons.
- Host: GitHub
- URL: https://github.com/electerm/electerm-icons
- Owner: electerm
- License: mit
- Created: 2025-09-19T07:59:46.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2025-09-19T08:12:02.000Z (7 months ago)
- Last Synced: 2025-09-19T10:28:45.094Z (7 months ago)
- Language: TypeScript
- Size: 88.9 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# electerm-icons
A lightweight TypeScript library providing essential file type icons, similar to vscode-icons but with a curated set of the most commonly used icons.
## Features
- 🎯 **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
## Installation
```bash
npm install electerm-icons
```
## Usage
```typescript
import {
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'
```
## Supported File Types
### Web Development
- HTML: `.html`, `.htm`, `.xhtml`
- CSS: `.css`, `.scss`, `.sass`, `.less`
- JavaScript: `.js`, `.mjs`, `.cjs`
- TypeScript: `.ts`, `.tsx`
- JSON: `.json`, `.jsonc`
- XML: `.xml`, `.xsd`, `.xsl`
### Programming Languages
- 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`
### Data & Configuration
- YAML: `.yaml`, `.yml`
- TOML: `.toml`
- INI: `.ini`, `.cfg`, `.conf`
- SQL: `.sql`, `.mysql`, `.pgsql`
### Documentation
- Markdown: `.md`, `.markdown`, `.mdown`
### Special Files
- `package.json`, `package-lock.json`
- `.gitignore`, `.gitattributes`
- `Dockerfile`, `docker-compose.yml`
- `CMakeLists.txt`, `Makefile`
- `LICENSE`, `README.md`
## API Reference
### Functions
#### `getIconForFile(fileName: string): string`
Returns the appropriate icon filename for a given file.
#### `getIconForFolder(folderName: string): string`
Returns the appropriate icon filename for a folder.
### Constants
- `DEFAULT_FILE`: Default file icon
- `DEFAULT_FOLDER`: Default folder icon
## Size Comparison
| Library | Icons | Size | Use Case |
|---------|-------|------|----------|
| vscode-icons | 1400+ | 7.7MB | Full IDE support |
| electerm-icons | 48 | ~0.14MB | Essential files only |
## Migration from vscode-icons
electerm-icons provides the same API as vscode-icons, making migration simple:
```typescript
// 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');
```
## Development
```bash
# Build the library
npm run build
# Run tests
npm test
# Development with watch mode
npm run dev
```
## License
MIT © ZHAO Xudong
## Credits
All icons in this project are sourced from [vscode-icons](https://github.com/vscode-icons/vscode-icons), licensed under the [MIT License](https://github.com/vscode-icons/vscode-icons/blob/master/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.
```