Material Design icons for GitHub's file browser, but in Safari (Material Icons for GitHub only works for Chrome/Firefox). The default config is for WordPress/PHP/React, pertinent to my personal development workflows, but file/folder type replacements are customizable.
- 🎨 Material Design icons from the Material Icon Theme
- 📦 Self-contained userscript (no external dependencies at runtime)
- ⚡ Works with GitHub's SPA navigation
- 🔧 Thousands of icons to choose from via priority list
- Install Userscripts extension for Safari
- Download the userscript: github-material-icons.user.js
- Open the downloaded file - Userscripts will prompt to install
- Browse to any GitHub repository and see the icons!
Note: This userscript is designed for Safari, but should work in Chrome/Firefox. If you already have a Material Icons browser extension installed, you may want to disable it to avoid conflicts.
- Install Tampermonkey (Chrome | Firefox)
- Click on the Tampermonkey icon and select "Create a new script"
- Copy the contents of github-material-icons.user.js
- Save and browse to any GitHub repository
- Node.js 14+ (no npm dependencies needed)
- Git (for cloning the material-icon-theme repository)
# Clone the repository
git clone https://github.com/ironprogrammer/github-material-icons-userscript.git
cd github-material-icons-userscript
# Fetch icons from material-icon-theme
npm run fetch
# Build the userscript
npm run build
# Or do both in one command
npm run allThe built userscript will be in dist/github-material-icons.user.js.
Edit src/priority-list.js to add/remove file types:
module.exports = {
extensions: [
'php',
'js',
'css',
// Add more extensions here
],
filenames: [
'package.json',
'composer.json',
// Add more specific filenames here
],
folders: [
'node_modules',
'vendor',
// Add more folder names here
],
};Then rebuild:
npm run allThe default priority list (src/priority-list.js) includes icons for:
- 50+ file extensions: PHP, JS, TypeScript, CSS, JSON, YAML, and more
- 25+ specific filenames: package.json, composer.json, webpack.config.js, etc.
- 47+ folder names: node_modules, vendor, .github, tests, etc.
Available Icons: The Material Icon Theme repository contains 1000+ file extensions, 1000+ filenames, and 500+ folder definitions. Your priority list determines which icons are included in the built userscript.
Optimized for:
- WordPress core and plugin development
- PHP projects with Composer
- Modern JavaScript with npm/webpack/vite
- React/TypeScript applications
- Shell scripting and dotfiles
-
Fetch Script (
scripts/fetch-icons.js):- Clones the material-icon-theme repository to
vendor/ - Parses TypeScript icon definitions to build mappings
- Copies only the needed SVG files (based on
src/priority-list.js) tocache/icons/
- Clones the material-icon-theme repository to
-
Build Script (
scripts/build.js):- Reads your priority list and icon mappings
- Loads corresponding SVG files from cache
- Converts SVGs to base64 data URIs
- Generates a self-contained userscript with all icons embedded
-
Userscript (runs in browser):
- Detects file/folder types on GitHub pages
- Replaces GitHub's default icons with Material Design icons
- Supports SPA navigation and tree view
github-material-icons-userscript/
├── src/
│ └── priority-list.js # YOUR icon selection (customizable)
├── scripts/
│ ├── fetch-icons.js # Fetches icons from material-icon-theme
│ └── build.js # Builds the final userscript
├── cache/ # Cached icon files (git-ignored)
│ ├── fileIcons.json # Parsed file icon mappings
│ ├── folderIcons.json # Parsed folder icon mappings
│ └── icons/ # SVG files
├── vendor/ # Cloned material-icon-theme repo (git-ignored)
└── dist/
└── github-material-icons.user.js # Built userscript (~150 KB)
The built userscript is approximately 150 KB, which includes all selected icons embedded as base64 data URIs. The size depends on how many icons you include in your priority list.
- Icons from Material Icon Theme
- Inspired by Material Icons for GitHub
Icons are from the Material Icon Theme project and retain their original Apache 2.0 License.