15

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

How do you change theme with Drush?

5 Answers 5

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
    Commented 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
    Commented Sep 18, 2018 at 15:07
36

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
  • 8
    Best answer. And if you want to set the admin theme, you can replace "default" with "admin" in the third line. Commented Feb 3, 2020 at 21:29
  • 3
    I can also confirm that these commands work with Drush 10.x and Drupal 9.x.
    – karolus
    Commented Nov 9, 2020 at 17:35
  • 4
    To set admin theme one can use: drush config-set system.theme admin THEME_MACHINE_NAME Commented 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
    Commented 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
    Commented Apr 28, 2019 at 8:49
1

If you want to change the admin theme using Drush, you can use below command.

drush config-set system.theme admin <theme_machine_name>

Eg.

drush config-set system.theme admin seven    

If the theme is not installed, first install the theme using below command

drush theme:en seven

Again run the above command to set admin theme.

1
  • This works with drupal 10. Also useful: drush config-get system.theme, drush config-set system.theme default olivero
    – user13097
    Commented Feb 11 at 7:16
-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
    Commented Apr 28, 2019 at 8:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.