Create Admin theme in Magento2

Create Admin theme in Magento2Create Admin theme in Magento2:

Creating a admin theme is same as the way we create for frontend in magento 2.

First we have to register our admin theme as like below

Step:1 app/code/Jute/Backend/registration.php

<?php
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE,    
'Jute_Backend',    __DIR__);
?>

Step:2 app/code/Jute/Backend/etc/di.xml

<?xml version="1.0"?>
<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">Jute/Backend</item>
</argument>
</arguments>
</type>
</config>

Step:3 app/code/Jute/Backend/etc/module.xml

<?xml version="1.0"?><config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Jute_Backend" setup_version="0.0.1">
<sequence><module name="Magento_Theme"/></sequence>
</module>
</config>

Step:4: Here we are setting Magento/backend as parent of our custom admin theme

app/design/adminhtml/Jute/Backend/theme.xml

<?xml version="1.0"?><theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
<title>Jute Admin Section</title>
<parent>Magento/backend</parent>
</theme>

Step:5

<?php\Magento\Framework\Component\ComponentRegistrar::register(    
\Magento\Framework\Component\ComponentRegistrar::THEME,    
'adminhtml/Jute/Backend', __DIR__);?> 

Yes now our custom admin theme is ready use. Once above code declaration is done then run following necessary commands

1. Clear pub/static & var/generation

2. php bin/magento setup:upgrade

3. php bin/magento setup:static-content:deploy

4. Check you DB theme table there will be new row must create once we run the above commands.

In Nature We Trust !! Save Agriculture !!!

2 thoughts on “Create Admin theme in Magento2”

Leave a Reply