Scaffolds a new custom theme package (Astro-based) that you can use with spg build --theme.
spg create-theme <name> [options]The command creates a new theme by copying the base theme template (bundled with the package) and customizing it with your theme name. The generated theme is a 1:1 copy of the modern theme that users are familiar with, including:
package.json,astro.config.ts,tsconfig.jsonsrc/pages/index.astro(main entry point)- Full-featured components (Hero, GallerySection, PhotoSwipe lightbox, SubGalleries, CTA banner, Footer)
- Responsive layouts with blurhash placeholders and AVIF/JPG support
- Query parameter customization utilities
- All configuration files (ESLint, Prettier, etc.)
The command:
- Copies all files from the bundled base theme template (excluding build artifacts like
node_modules,.astro,dist, etc.) - Updates
package.jsonwith your theme name - Generates
README.mdfor the new theme (from the template'sREADME_BASE.md)
By default, the theme is created in ./themes/<name>. If you run the CLI from inside a monorepo workspace, it will prefer creating themes under the monorepo root ./themes/<name>.
Note: The base theme template is bundled with the
simple-photo-gallerypackage, sospg create-themeworks out of the box after installation. The template source is located atgallery/src/modules/create-theme/templates/basein the repository. For local development, ifthemes/baseexists in your workspace root, it will be used as a fallback (allowing you to test template changes without modifying the bundled template).
| Option | Description | Default |
|---|---|---|
-p, --path <path> |
Path where the theme should be created (directory must not exist) | ./themes/<name> |
-v, --verbose |
Show detailed output | |
-q, --quiet |
Only show warnings/errors | |
-h, --help |
Show command help |
# Create ./themes/my-theme
spg create-theme my-theme
# Create in a custom directory
spg create-theme my-theme --path ./my-theme
# Build a gallery using the generated theme (local path)
spg build --theme ./themes/my-theme -g /path/to/gallerySee the Custom Themes guide for:
- Required theme structure
- How the build process passes
GALLERY_JSON_PATH/GALLERY_OUTPUT_DIR - How to run
astro devwhile developing a theme