Menu Close

Create new custom theme in magento2

Magento provide default theme when install so I would recommend to keep Magento’s blank theme as parent so that all necessary functionalities for theme will automatically inherit which you can define in theme.xml file. All you need to follow Magento standards to create theme

Steps to make theme as following

  1. Create theme folder structure
  2. Define, registration and composer
  3. Adding custom content
  4. Activate new theme on storefront

Create theme folder structure

All you need to create theme’s folder structure in app/design/frontend/ folder

For example: app/design/frontend/<VendorName>/<ThemeName>

Define, registration and composer

  1. Create file app/design/frontend/<VendorName>/<ThemeName>/theme.xml
<?xml version="1.0"?>
<theme xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">

2. Theme’s details and dependencies can be define in composer.json file but this could be optional as initial phase. use following code in app/design/frontend/<VendorName>/<ThemeName>/composer.json file

    "name": "VendorName/ThemeName",
    "description": "Theme description text",
    "require": {
        "php": "~5.5.0|~5.6.0|~7.0.0",
        "magento/theme-frontend-blank": "100.0.*",
        "magento/framework": "100.0.*"
    "type": "magento2-theme",
    "version": "100.0.1",
    "license": [
    "autoload": {
        "files": [

3. Registration

You may noticed that in composer.json we have registration.php file which needs to create to register theme in Magento


Adding Custom Content

Basic structure of theme is already completed and we can activate this theme from admin panel but it will look same like Magento Blank Theme so we can further define theme’s css, images, logo and other content

  • New logo for theme

Upload logo in app/design/frontend/<VendorName>/<ThemeName>/web/images/logo.svg file or you can define in app/design/frontend/<VendorName>/<ThemeName>/Magento_Theme/layout/default.xml

<page xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <referenceBlock name="logo">
        <argument name="logo_file" xsi:type="string">images/new_logo.png</argument>
        <argument name="logo_width" xsi:type="number">250</argument>
        <argument name="logo_height" xsi:type="number">250</argument>
  • Further you can create web/css, web/fonts, web/images folders and files inside to define more code and content to design
  • Add custom layout using xml file as following


<page xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <!-- Custom stylesheet -->
    <css src="css/new_theme.css"/>
    <!-- Custom JavaScript -->
    <script src="js/new_theme.js"/>

Activate new theme on storefront

Theme customization depend upon your requirement for new theme. Once completed content and design then we can apply theme from Admin Panel.

All you need to login to Admin Panel

Go to Content -> Configuration -> (select store view and Edit )

Select ThemeName and save configuration

Clear cache from Cache Management or run following commands

php bin/magento cache:flush

Please feel free to say for any issue faced.

Leave a Reply

Your email address will not be published. Required fields are marked *