theme.json reference for MyStudio themes

amtekkie · Today

Every MyStudio theme has a theme.json in its folder: its name, version, parent theme, stylesheets, the modules it supports, which layout choices it handles, its font roles and the starting values of its settings. This is the full reference.

In short
  • name is the theme's identity: changing it makes a new theme
  • Only stylesheets listed here load; only modules listed here run
  • Run a full sync after any change; cli.php validate {slug} checks it

A complete example

{
    "name": "My Theme",
    "version": "1.2",
    "parent": "mystudio-default",
    "description": "A calm, editorial look for writing communities.",
    "color_mode": "light",
    "properties": { "editortheme": "default.css", "imgdir": "images" },
    "stylesheets": [
        { "name": "my-theme.css", "attachedto": "", "order": 50 },
        { "name": "threads.css", "attachedto": "showthread.php|forumdisplay.php", "order": 51 }
    ],
    "modules": ["ms-options", "ms-editor-extras", "ms-forum-icons"],
    "supports": { "sidebar": ["left", "off"], "color_modes": ["light", "dark", "auto"] },
    "fonts": { "heading": { "label": "Headings font", "var": "--ms-font-heading" } },
    "google_fonts": ["Playfair Display"],
    "studio_options": { "radius": "sharp", "font_heading": "gf:playfair-display" }
}

Identity

KeyMeaning
nameRequired. The theme's name in MyBB, unique on the forum. Changing it creates a new theme on the next sync, because MyStudio finds the database copy by name.
versionYour theme's version, shown on its card. A four-digit value such as 1839 is read as MyBB's template version instead.
descriptionShown on the theme's card.
parentThe slug of the parent theme for a child theme. Up to five levels deep.

Stylesheets and properties

KeyMeaning
stylesheetsA list of {"name", "attachedto", "order"}. attachedto "" = every page; a script name such as showthread.php = only there (several with |). Files in css/ load only when listed. Child themes merge by name.
propertiesMyBB theme properties such as editortheme and imgdir; merged key by key in child themes.

Modules

modules lists the module ids the theme supports. Only listed modules (and site tools such as SEO) load under the theme, and exporting the theme packs them. MyStudio Default lists all of them.

supports: which layout choices the theme handles

MyStudio Options only shows the choices a theme declares. A key left out hides that option; a list narrows its values.

"supports": {
  "header_logo": ["left", "center"],
  "header_links": ["none", "left", "center", "right", "below"],
  "header_search": ["none", "button", "box"],
  "header_search_position": ["end", "links"],
  "header_user": ["sidebar", "right", "left", "links", "bar"],
  "header_user_bar": ["below_bar", "below_links"],
  "header_ad": true,
  "header_sticky": true,
  "container": ["fixed", "wide", "fluid", "boxed"],
  "sidebar": ["left", "right", "off"],
  "sidebar_blocks": true,
  "menu_items": true,
  "footer": ["minimal", "centered", "columns"],
  "postbit": ["horizontal", "classic"],
  "color_modes": ["dark", "light", "auto"]
}

A theme without supports still gets the options that work everywhere: announcement bar, ads, latest activity, back-to-top, fonts and shape, signatures. The module publishes the choices as <body> classes (such as ms-sb-left, ms-ct-wide), CSS variables and template variables.

Colour mode

color_mode is "dark" or "light": the theme's default until an admin picks a mode in MyStudio Options. With color_modes in supports, MyStudio sets data-bs-theme on <html>, so provide both palettes in your CSS.

Fonts

  • fonts: up to four font roles, each bound to a CSS variable your CSS uses: {"heading": {"label": "Headings font", "var": "--ms-font-heading"}}. The key primary also sets your own text variable when the admin picks a text font. Other keys become options named font_{key}.
  • google_fonts: Google font families your theme is designed for. The Fonts page offers them for download on a new forum.

Use the variable with a fallback in your CSS: font-family: var(--ms-font-heading, inherit). See fonts.

studio_options: starting values

studio_options sets the theme's own defaults for MyStudio Options, used until an admin saves their own: for example {"sidebar": "off", "container": "wide", "radius": "sharp", "font": "mono"}. In child themes it merges down the chain. The ten shipped child themes are good examples.

Other keys

  • shop_storefront: true asks the Shop for its storefront block, placed with {$ms_shop_storefront} in the index template (MyStore uses it).

After changing theme.json, run a full sync. cli.php validate {slug} checks the file, the stylesheet list and the templates; see the command line.