A theme controls shared appearance and supplies assets such as a header, footer and theme variables. Keep your catalog's API and PHP service in the plugin.
This chapter follows the Theming Quickstart, with asset names checked against the inspected source.
Create the theme directory
Create themes/my-custom-theme in the partner repository.
Start with a small asset-based theme:
themes/my-custom-theme/
addon.json
assets/
variables.json
header.html
styles.css
You can also use the Foundation theme supplied by your target checkout as a starting point. In the inspected source it lives at addons/themes/theme-foundation. Preserve any license notices and review its dependencies before copying it.
Declare the assets
Create addon.json:
{
"key": "my-custom-theme",
"name": "My Custom Theme",
"description": "An example asset-based theme.",
"version": "1.0.0",
"type": "theme",
"isResponsive": true,
"Features": { "DataDrivenTheme": true },
"assets": {
"variables": { "type": "json", "file": "variables.json" },
"header": { "type": "html", "file": "header.html" },
"styles": { "type": "css", "file": "styles.css" }
}
}
Asset files are resolved inside the theme's assets directory. A declared file must exist.
This example uses JSON variables and an HTML header. The inspected theme system also supports NEON variables and Twig header/footer assets. Choose the formats supplied and supported by your target release.
Add your organization's author and license metadata before distribution.
Set a theme variable
Add this to assets/variables.json:
{
"global": {
"mainColors": {
"primary": "#2457C5"
}
}
}
global.mainColors.primary is read by the inspected theme variable system. It supplies the primary brand color; individual components can have their own overrides.
Set only the variables you intend to change. Check Theme Variable Documentation and the variables used by the component you are styling.
Avoid styling React components through generated class names. Those classes are implementation details.
Add a small header
Create assets/header.html:
<div class="myCustomThemeHeader">
<a href="/">Resource Community</a>
</div>
Create assets/styles.css:
.myCustomThemeHeader {
padding: 1rem;
background: #173766;
color: white;
}
.myCustomThemeHeader a {
color: inherit;
}
This CSS is for the theme's header/footer asset area. Use theme variables for supported community component styling.
A header asset adds content around the built-in header. It does not automatically replace all built-in navigation. Confirm placement in the target layout.
Connect the local theme
Using the directory layout from local setup, create the relative link:
cd ~/vnla/vanilla/themes
ln -s ../../my-custom-code/themes/my-custom-theme my-custom-theme
cd ~/vnla/vanilla
vnla clear-caches
vnla build
Check an existing destination before creating the link.
Select the theme using the theme management interface available in your local release. The Theming Quickstart describes a local configuration fallback when the cloud theme interface is absent:
// Local site configuration only.
$Configuration["Garden"]["Theme"] = "my-custom-theme";
$Configuration["Garden"]["MobileTheme"] = "my-custom-theme";
$Configuration["Garden"]["CurrentTheme"] = "my-custom-theme";
Existing locale or site-section theme assignments can affect the active theme. If the site already has assignments, use the supported theme application flow instead of assuming these three values override every assignment.
Verify the active theme
Refresh the community page and inspect its theme assets. Confirm that the active theme is the file-based theme you changed.
Dashboard theme edits can create a database-backed theme revision. After such an edit, changes to the original files may no longer control the active appearance. Check theme identity before debugging CSS.
Test the header at narrow and wide widths. Check links, keyboard focus and contrast. Confirm the catalog widget still behaves correctly.
Deploy the theme through the partner repository workflow. A new theme may need initial enablement through Support before it appears on a hosted site.