Previously, we saw the steps to create an admin theme in Magento 2.
Custom admin themes in Magento 2 can be created for:
- customized backend
- brand logo
- handy tools
- responsiveness
- favourable colours
- easy administration
However, you also need to apply an admin theme in Magento 2 for leveraging these benefits.
The below tutorial shows the stepwise method for the same:
Steps to apply an admin theme in Magento 2:
Requirements:
1. Set the Magento into developer mode. Refer Magento 2 modesfor the steps.
2. Create a custom admin theme as shown earlier.
3. Create module.xml in app/code/[Vendor]/[Module]/etc and add the following code:
<module name="[Vendor]_[Module]" setup_version="0.0.1"> <sequence> <module name="Magento_Theme"/> </sequence> </module>
Applying a custom admin theme in Magento 2:
1.Create di.xml in app/code/[Vendor]/[Module]/etc/adminhtml and add the following code:
<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">[Namespace]/[themename]</item> </argument> </arguments> </type> </config>
2. Run the bin/magento setup:upgrade command to update the components.
3. Open the Admin in the browser and view the new theme applied.
That’s it. Also before applying admin theme I recommend you to change default admin logo in Magento 2 for branding purposes.
Do share the post with the Magento community via social media.