Here is an example of how you can create a custom theme in Magento 2:
- Create a directory for your theme under
app/design/frontend/[Vendor]/[Theme] - Create a
theme.xmlfile in your theme directory with the following content:
[code]
<theme xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:noNamespaceSchemaLocation=”urn:magento:framework:Config/etc/theme.xsd”>
<title>My Custom Theme</title>
<parent>Magento/blank</parent>
</theme>
<title>My Custom Theme</title>
<parent>Magento/blank</parent>
</theme>
[/code]
- Create a
composer.jsonfile in your theme directory with the following content:
[code]
{
“name”: “vendor/theme”,
“description”: “My Custom Theme”,
“require”: {
“php”: “~7.1.3||~7.2.0||~7.3.0”,
“magento/theme-frontend-blank”: “100.2.*”,
“magento/framework”: “100.2.*”
},
“type”: “magento2-theme”,
“version”: “1.0.0”,
“license”: [
“OSL-3.0”,
“AFL-3.0”
],
“autoload”: {
“files”: [
“registration.php”
]
}
}
“name”: “vendor/theme”,
“description”: “My Custom Theme”,
“require”: {
“php”: “~7.1.3||~7.2.0||~7.3.0”,
“magento/theme-frontend-blank”: “100.2.*”,
“magento/framework”: “100.2.*”
},
“type”: “magento2-theme”,
“version”: “1.0.0”,
“license”: [
“OSL-3.0”,
“AFL-3.0”
],
“autoload”: {
“files”: [
“registration.php”
]
}
}
[/code]
- Create a
registration.phpfile in your theme directory with the following content:
[code]
<?php
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::THEME,
‘frontend/Vendor/theme’,
__DIR__
);
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::THEME,
‘frontend/Vendor/theme’,
__DIR__
);
[/code]
- Run the following command from the Magento root directory to register your theme:
[code]
php bin/magento setup:upgrade
php bin/magento setup:deploy -f
[/code]
- Log in to the Magento Admin and navigate to
Content > Design > Configuration - Click the
Editbutton for the store view you want to apply your custom theme to - In the
Design Configurationpage, select your custom theme in theApplied Themedropdown - Click the
Save Configurationbutton
Your custom theme should now be active for the specified store view.
You can now start creating custom templates, layouts, and styles for your theme. For more information, you can refer to the Magento 2 documentation on creating a custom theme: https://devdocs.magento.com/guides/v2.4/frontend-dev-guide/themes/theme-create.html


