Magento – magento 2 : how get the list of themes in the magento site

magento2moduletheme

I want all information about the theme in my module code how can I grab the theme information.The Theme that I have in my Magento like WordPress we can get all the themes information is it possible here.

This example is useful for magento 1.X what about magento 2.

Mage::getSingleton('core/design_package')->getPackageList();
Mage::getSingleton('core/design_package')->getThemeList();

Best Answer

I know it's an old question, but since I was looking for the same thing, for future visitors:

use Magento\Framework\View\Design\Theme\ListInterface;

...

public function __construct(
    ListInterface $themeList
) {
    $this->themeList = $themeList;
}

public function getThemes()
{
    foreach ($this->themeList as $theme) {
        /** @var \Magento\Theme\Model\Theme $theme */
        // do things
    }
}
Related Topic