Is it possible for a module to install a separate theme, or should I just ask to the users who install the module to also install a specific theme for a better experience?

  • The later, they are completely separate things or rather should be treated like that.
    – Alex Gill
    May 10, 2013 at 14:03
  • 3
    Maybe you're looking for something like a Distribution? May 10, 2013 at 14:06

1 Answer 1


Yes, it is possible. You can create a MY_MODULE.install file, add a HOOK_update() where you can call theme_enable and variable_set() to set it as the default theme.

Here is an example:

 * Enable my_new_theme and set as default.
function MY_MODULE_update_7001() {
  $themes_to_enable = ['my_new_theme'];

  // Set the theme as default.
  variable_set('theme_default', 'my_new_theme');
  • Probably rather hook_install.
    – leymannx
    Dec 25, 2021 at 16:07

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.