Skip to content

feat: support themes in subdirectories#223

Open
tmchow wants to merge 1 commit intooriginalankur:mainfrom
tmchow:feat/157-themes-subdirectories
Open

feat: support themes in subdirectories#223
tmchow wants to merge 1 commit intooriginalankur:mainfrom
tmchow:feat/157-themes-subdirectories

Conversation

@tmchow
Copy link
Copy Markdown

@tmchow tmchow commented Apr 3, 2026

Summary

Replaces os.listdir() with os.walk() in get_available_themes() so theme JSON files in nested directories under themes/ are discovered. Theme names use forward-slash relative paths (e.g. custom/my_theme for themes/custom/my_theme.json).

PS - Love this project!

Why this matters

Reported in #157. Users with many themes want to organize them into subdirectories (original/, custom/, etc.) but the current code only scans the top-level themes/ directory.

Changes

  • get_available_themes() (line 161): uses os.walk() to recursively find .json files. Returns theme names as relative paths with forward slashes for cross-platform consistency. Flat themes sort first, then nested themes alphabetically.
  • list_themes() (line 843): groups nested themes by directory with [group] headers for readability. Flat themes display first, unchanged.
  • load_theme(): no changes needed. os.path.join(THEMES_DIR, f"{theme_name}.json") already resolves paths containing subdirectory prefixes correctly.

Testing

  • Python syntax compilation passes
  • flake8 lint passes (max-line-length=160, matching CI config)
  • Existing flat themes continue to work unchanged

Fixes #157

This contribution was developed with AI assistance (Codex).

Replace os.listdir() with os.walk() in get_available_themes() so
theme JSON files in nested directories are discovered. Theme names
use forward-slash relative paths (e.g. "custom/my_theme"). The
list-themes output groups nested themes by directory.

Fixes originalankur#157
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

themes in subdirectories

1 participant