Template.json

Every theme must include a template.json file with metadata.

Complete Schema

{
  "template": {
    "name": "my-theme",
    "description": "A beautiful custom theme for PteroCA",
    "author": "Your Name",
    "version": "1.0.0",
    "license": "MIT",
    "pterocaVersion": "0.6",
    "phpVersion": ">=8.2",
    "options": {
      "supportDarkMode": true,
      "supportCustomColors": true
    }
  }
}

Field Descriptions

Required Fields

All fields must be nested inside the "template" object.

  • name (required): Unique theme identifier in kebab-case

    • Must match theme folder name

    • Used internally by PteroCA

    • Example: "my-theme", "dark-mode"

  • description (required): Brief theme description

    • Shown in admin panel theme settings

    • Keep concise (1-2 sentences)

    • Example: "A beautiful custom theme for PteroCA"

  • author (required): Theme author name

    • Simple string with author name

    • Example: "Your Name", "PteroCA Team"

  • version (required): Semantic version number

    • Format: MAJOR.MINOR.PATCH

    • Example: "1.0.0", "2.3.1"

  • license (required): License identifier

    • SPDX license identifier recommended

    • Example: "MIT", "GPL-3.0", "Apache-2.0"

  • pterocaVersion (required): Minimum PteroCA version

    • Theme won't work on older versions

    • Format: "MAJOR.MINOR" (no patch version)

    • Example: "0.6"

  • phpVersion (required): Minimum PHP version

    • Constraint operator format

    • Example: ">=8.2", "^8.2"

Optional Fields

  • options (optional): Theme capability flags

    • supportDarkMode (boolean): Theme supports dark mode toggle

    • supportCustomColors (boolean): Theme supports custom color configuration

    • If not specified, both default to false

Example template.json

Minimal Example

Complete Example with Options

Version Constraints

PHP Version

Use the phpVersion field with constraint operators:

Common operators:

  • >=8.2 - PHP 8.2 or higher

  • ^8.2 - Compatible with 8.2.x

PteroCA Version

Use the pterocaVersion field with MAJOR.MINOR format (no patch version):

Format: Always use "MAJOR.MINOR" format without patch version.

Theme Options

The options object enables theme capabilities that affect PteroCA's theme settings UI:

supportDarkMode

  • Type: boolean

  • Default: false

  • Effect: When enabled, users can toggle between light and dark modes in theme settings

  • Requirement: Your theme must provide CSS for both modes

supportCustomColors

  • Type: boolean

  • Default: false

  • Effect: When enabled, users can customize primary colors in theme settings

  • Requirement: Your theme must use CSS variables for color customization

Validation

To validate your template.json:

After creating the theme, test by activating it in the admin panel (Settings → Appearance → Current theme).

Common Errors

Invalid JSON

Error: Syntax error in template.json

Solution: Validate JSON syntax

  • Remove trailing commas

  • Use double quotes, not single quotes

  • Ensure proper bracket/brace matching

Name Mismatch

Error: Theme name doesn't match folder name

Solution: Ensure name field matches theme folder:

Version Format

Error: Invalid version format

Solution: Use semantic versioning:

Last updated