13

I tried drush disable theme-name and afterwards drush enable theme-name, but it didn't work.

How do you change theme with Drush?

4 Answers 4

13

Commands to be used in theme using drush :

theme-enable        => pm-enable
theme-disable       => pm-disable
theme-info          => pm-info
theme-list          => pm-list --type=theme
theme-list-enabled  => pm-list --type=theme --status=enabled
theme-set-default   => vset theme_default
theme-set-admin     => vset admin_theme
theme-status        => status theme
2
  • 3
    This only applies to Drupal 6 and 7.
    – Gogowitsch
    Oct 3, 2017 at 11:04
  • 1
    I didn't find this worked, I had to then also do this: drush vset theme_default THEMENAME and because I had errors relating to my theme not being active, I couldn't access the set default through the admin pages (article I read here: pixelthis.gr/blog/drush-enable-theme-and-set-default)
    – ja_him
    Sep 18, 2018 at 15:07
23

For Drush 9.5.2 and Drupal 8.6.5 I use the following:

drush theme:uninstall THEME_MACHINE_NAME
drush theme:enable THEME_MACHINE_NAME
drush config-set system.theme default THEME_MACHINE_NAME
3
  • 3
    Best answer. And if you want to set the admin theme, you can replace "default" with "admin" in the third line. Feb 3, 2020 at 21:29
  • 2
    I can also confirm that these commands work with Drush 10.x and Drupal 9.x.
    – karolus
    Nov 9, 2020 at 17:35
  • 1
    To set admin theme one can use: drush config-set system.theme admin THEME_MACHINE_NAME Sep 4, 2021 at 20:35
1

With Drush 7 and 8, it is no longer necessary to be so verbose. If you want to enable a theme use the alias:

drush en your-theme-name
drush dis your-theme-name

For example:

drush en seven
drush dis bartik

You may want to clear your caches after enabling or disabling themes. For more information please see: DrushCommands.com

2
  • 2
    For a theme, it is usually not enough to just enable it. You also have to set it as a default. In Drupal 8, the command is this: drush config-set system.theme default NAME_OF_YOUR_THEME
    – Gogowitsch
    Oct 3, 2017 at 11:04
  • 1
    The question is how to change the theme. If there is already a default, you can't change it until you can set another one as default, and this does not answer that.
    – Christia
    Apr 28, 2019 at 8:49
-1

drush dis and drush disable aren't anymore valid, in Drupal 8. Their Drupal 8 equivalent are the following commands.

drush pm-uninstall THEME_MACHINE_NAME
drush pm-uninstall MODULE_MACHINE_NAME
1
  • 1
    This won't work on a theme set as default.
    – Christia
    Apr 28, 2019 at 8:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy