Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>FileColorByAgeNew to Visual Studio Code? Get it now.
FileColorByAge

FileColorByAge

timepp

|
1 install
| (0) | Free
Color Explorer files by modification time and folders by their newest descendant file.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

FileColorByAge

Color and badge Explorer files by their saved modification time. Color folders using the newest file anywhere in their descendant tree.

The extension uses VS Code's FileDecorationProvider API for colors, badges, and tooltips.

Features

  • Configure rolling time windows such as 1d, 2w, 3m, and 5y.
  • Apply the first matching time rule to each file.
  • Automatically propagate the newest descendant file's decoration through ancestor folders.
  • Use 10 customizable color presets or built-in VS Code theme color IDs.
  • Refresh files and their ancestors on file creation, modification, and deletion.
  • Recheck time windows every minute, refreshing only entries whose matching rule changes, and refresh when settings change.

Preview

Dark theme Light theme
FileColorByAge in a dark theme FileColorByAge in a light theme

Release packaging resolves screenshot paths to HTTPS URLs in this repository. Push updated screenshots before packaging.

Default rules

These rules apply automatically when fileColorByAge.rules is unset:

{
  "fileColorByAge.rules": [
    { "modifiedWithin": "1d", "color": "charts.blue" },
    { "modifiedWithin": "1w", "color": "charts.green" },
    { "modifiedWithin": "1m", "color": "charts.yellow" },
    { "modifiedWithin": "1y", "color": "foreground" },
    { "modifiedWithin": "100y", "color": "descriptionForeground" }
  ]
}

To customize colors or time windows, set fileColorByAge.rules in your user or workspace settings.json. Your configured array replaces the entire default array. Place shorter windows first; setting the array to [] disables file and folder decorations.

For existing configurations, use modifiedWithin and color, and remove pattern, flags, and propagate.

When upgrading from Explorer File Colors, rename explorerFileColors.rules to fileColorByAge.rules and replace the explorerFileColors.custom color prefix with fileColorByAge.custom in rules and workbench.colorCustomizations.

Rule format

type Rule = {
  modifiedWithin: string;
  color: string;
  badge?: string;
  tooltip?: string;
};
  • modifiedWithin: a positive integer followed by lowercase d, w, m, or y. One day is 24 hours, one week is 7 days, one month is 30 days, and one year is 365 days. Examples: 12d, 2w, 3m, 5y (1825 days). Use an integer starting with 1-9 and a duration that fits a JavaScript safe integer in milliseconds. The exact boundary is included.
  • color: a VS Code theme color ID.
  • badge: an optional one- or two-character badge. Longer badges are trimmed.
  • tooltip: optional tooltip text.

File age is measured from the saved filesystem modification time to the current time. Files whose age falls within a rule receive its decoration.

Folder propagation

For each folder, the extension recursively compares descendant file modification times. The newest file determines the folder's rule, using the same first-match rule order as individual files. Directory modification times are excluded from this comparison.

For example:

project/                 -> 1d color
  older.txt              -> 1w color
  nested/                -> 1d color
    newest.txt           -> 1d color

When newest.txt was modified today and older.txt was modified two days ago, both nested and project use the 1d decoration.

A folder automatically receives its newest file's first matching decoration. Empty folders and folders whose newest file falls outside every time window stay undecorated.

The extension assigns folder decorations directly, ensuring that file modification times determine which color wins. Scans share cached subtree results. File events refresh affected ancestors, while configuration changes invalidate cached results. The one-minute check reuses saved modification times and refreshes only entries that move between time rules, keeping unchanged entries stable. Traversal includes regular descendant files and skips directory symbolic links to keep scans within the directory tree and avoid cycles.

Customizing colors

Rules use VS Code theme color IDs. Choose:

  • One of the extension's 10 presets: fileColorByAge.custom01 through fileColorByAge.custom10.
  • Built-in decoration colors such as gitDecoration.modifiedResourceForeground.
  • Built-in chart colors such as charts.green, charts.blue, or charts.orange.
  • Other theme color IDs such as foreground, descriptionForeground, or warningForeground.

Customize their actual colors with workbench.colorCustomizations:

{
  "workbench.colorCustomizations": {
    "fileColorByAge.custom01": "#4FC1FF",
    "fileColorByAge.custom02": "#00FFAA",
    "fileColorByAge.custom03": "#D7BA7D"
  }
}

Both rule configuration and color customization can be placed in user or workspace settings.

Development

Install dependencies and compile:

npm install
npm run compile

Run a local development window in Code Insiders:

code-insiders --new-window --extensionDevelopmentPath="D:\src\VSCodeExplorerFileColors"

Open a folder in that window and configure fileColorByAge.rules. After recompiling a change, run Developer: Reload Window.

Run tests:

npm test

Tests use an isolated workspace under .vscode-test/workspace.

Package and install a VSIX:

npm run package
code-insiders --install-extension ".\file-color-by-age-0.0.7.vsix" --force

Publishing

The extension ID is timepp.file-color-by-age. Manage releases in the timepp publisher portal and upload the generated VSIX. Increment version in package.json and package-lock.json for each subsequent release.

Inspiration

FileColorByAge is inspired by Explorer File Colors by mfascia. It builds on the original MIT-licensed project with modification-time rules and automatic newest-descendant folder colors.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft