Similar question to How can I programmatically get the theme name? and How do I programmatically change the admin theme?.

I want to simply obtain the current admin theme machine name and human name, even when I might not be on a page where the admin theme is enabled as the active theme.

This information doesn't appear to be directly accessible via the ThemeManager class.

1 Answer 1


This is config and you can get it with the following snippet.

$admin_theme = \Drupal::config('system.theme')->get('admin');
$admin_theme_name = \Drupal::service('theme_handler')->getName($admin_theme);

Or with Drush:

drush cget system.theme admin

Your Answer

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

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