No description
  • CSS 83.4%
  • Python 11.5%
  • Shell 5.1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Ben 2b57afb2c2 Align build.sh with forgejo-templates pattern
Multi-file CSS/JS glob, conditional FOUC cloak + footer.tmpl
generation when JS files are present.
2026-03-05 12:39:36 -05:00
css Initial commit: file-type icons for Forgejo 2026-03-05 09:42:25 -05:00
icons Initial commit: file-type icons for Forgejo 2026-03-05 09:42:25 -05:00
.gitignore Initial commit: file-type icons for Forgejo 2026-03-05 09:42:25 -05:00
build-icons.py Initial commit: file-type icons for Forgejo 2026-03-05 09:42:25 -05:00
build-icons.sh Initial commit: file-type icons for Forgejo 2026-03-05 09:42:25 -05:00
build.sh Align build.sh with forgejo-templates pattern 2026-03-05 12:39:36 -05:00
LICENSE Add proper attribution for upstream icon licenses 2026-03-05 11:44:41 -05:00
NOTICE Add proper attribution for upstream icon licenses 2026-03-05 11:44:41 -05:00
README.md Add proper attribution for upstream icon licenses 2026-03-05 11:44:41 -05:00

forgejo-file-icons

File-type icons for Forgejo's repository file browser. Replaces the default monochrome octicons with colored SVG icons based on file extension and filename.

License

What it does

Uses CSS attribute selectors on Forgejo's data-entryname attributes to swap file/folder icons with language-specific SVGs from vscode-great-icons and vscode-material-icon-theme.

Covers 1200+ SVG icons across hundreds of file extensions and filenames.

Installation

1. Copy icons to your Forgejo assets directory

cp -r icons/ /path/to/forgejo/custom/public/assets/icons/

2. Build and install the template

bash build.sh
cp templates/custom/header.tmpl /path/to/forgejo/custom/templates/custom/header.tmpl

3. Restart Forgejo

The icons will appear immediately in repository file listings.

Forgejo paths

Setup Custom directory
Binary $FORGEJO_WORK_DIR/custom/ or set via FORGEJO_CUSTOM
Docker /data/gitea/ (mount as volume)
Cloudron /app/data/custom/

Static assets go in custom/public/ and templates in custom/templates/.

How it works

The CSS uses Forgejo's existing data-entryname attribute on table rows:

/* Match by extension */
tr.entry[data-entryname$=".rs"] .octicon-file {
    background-image: url('/assets/icons/rust.svg');
}

/* Match by exact filename */
tr.entry[data-entryname="Dockerfile"] .octicon-file {
    background-image: url('/assets/icons/docker.svg');
}

The default octicon SVG paths are made transparent and a background-image is set on the SVG element itself.

Rebuilding from source

To regenerate icons and CSS from the upstream VS Code icon repos:

# Requires: git, python3
bash build-icons.sh

# Then rebuild the template
bash build.sh

build-icons.sh shallow-clones the icon repos, extracts SVGs, and generates css/file-icons.css using the extension mappings from vscode-great-icons.

Adding custom icons

Edit css/file-icons.css and add a rule:

/* myformat */
tr.entry[data-entryname$=".xyz"] .octicon-file { background-image: url('/assets/icons/myicon.svg'); }

Place the SVG in icons/ and rebuild with bash build.sh.

License

Build scripts and CSS are MIT-licensed. SVG icons are redistributed from upstream projects under their own licenses:

Source License
vscode-great-icons MIT
vscode-material-icon-theme MIT
Material Design Icons (Pictogrammers) Apache 2.0
Material Symbols (Google) Apache 2.0

See NOTICE for full attribution and license texts.