Magento, Magento 2

How to Create Custom Admin Theme in Magento 2

How to Create Custom Admin Theme in Magento 2

In this tutorial, Today I will explain to how to create custom admin theme in Magento 2. Using custom admin theme, you can customize layout of admin dashboard. By Custom Admin Theme, You can customize backend panel with custom logo, custom fonts, change design of the panel etc. In this Magento 2 admin theme development article, we are going to understand the process of theme creation.

You may also like this :

Steps of Create Custom Admin Theme in Magento 2 :

1) First of all, Create registration.php file for register custom admin theme at app/design/adminhtml/RH/CustomTheme/ and paste the below code :


<?php
/**
 * Created By : Rohan Hapani
 */

use Magento\Framework\Component\ComponentRegistrar;

ComponentRegistrar::register(ComponentRegistrar::THEME, 'adminhtml/RH/CustomTheme', __DIR__);

2) After that, Create theme.xml file at app/design/adminhtml/RH/CustomTheme/ and paste the below code for set parent theme :


<?xml version="1.0"?>
<!--
/**
 * Created By : Rohan Hapani
 */
-->
<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
    <title>RH Custom Admin Theme</title>
    <parent>Magento/backend</parent>
</theme>

3) Then, Let’s assume that you have created simple module. After that, Create di.xml at app/code/RH/Helloworld/etc/ and paste the below code for set custom admin theme :


<?xml version="1.0"?>
<!--
/**
 * Created By : Rohan Hapani
 */
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
   <type name="Magento\Theme\Model\View\Design">
       <arguments>
           <argument name="themes" xsi:type="array">
               <item name="adminhtml" xsi:type="string">RH/CustomTheme</item>
           </argument>
       </arguments>
   </type>
</config>

4) In Last, Execute below commands :


php bin/magento s:up
php bin/magento s:s:d -f
php bin/magento c:c

That’s it !!!

Now, you can see in admin side that custom theme is applied successfully. Now, you can apply your custom admin theme changes for admin dashboard, panel, pages etc.

I hope this blog is easy to understand about how to create custom admin theme in Magento 2. In case, I missed anything or need to add some information, always feel free to leave a comment in this blog, I’ll get back with proper solution.

Keep liking and sharing !!

Tagged , ,