Drupal has often used a content management system (CMS). Mainly, the key role of Drupal themes is responsible for the virtual design and user interface of your site. Drupal provides the HTML markup, CSS, images, typography, and interactive experience that people encounter when they check out your site.
The default Drupal installation houses many themes that can easily be managed by the admin area. Each theme is a set of files including style sheets, Drupal-specific YAML files, Twig templates, images, and more, all contained within a directory. There are plenty of community-contributed themes available. Generally, themes are one of the first places to make your Drupal site unique by initiating code modification.
To personalize the design and interface of the site developers can create new themes. It happens by extending an existing theme by making minor changes or by creating a completely new design.
How to change Drupal themes?
In this post, we�ll show you how to change Drupal themes if you�re not actually going through the installation process. Themes play a vital role in the look and feel, colors, layout, and even the font size and style of the page.
Many times you feel the need to change your theme. This may be for holiday, seasonal, or another reason altogether. You can change your Drupal website theme by logging in as an administrator easily. To understand it in detail continue to go through this write-up but before that, first, learn various types of Drupal themes.
What are the different types of Drupal themes:
Drupal themes are divided into three types as given:
Core themes: Themes that are comprised of Drupal core and exist in the /core/themes directory.
Contributed themes: Themes that are downloaded from Drupal.org, and are typically placed in the /themes/contrib directory.
Custom themes: Themes that are created by you or a theme developer for your use case, and are typically positioned in the /themes/custom directory
How To Download and Install a New Drupal Theme?
Before moving towards the installation of the new Drupal theme, you need to download the drupal first.
Download a theme
Basically, New themes can be either customized themes created by you or themes downloaded from Drupal.org. Substantially, before the installation of the theme, its files need to be placed into the /themes directory at the root of your Drupal project in a place where Drupal can find them.
Themes can be installed with Composer:
composer require drupal/mayo
Or downloaded manually.
Install a theme via the UI
Once the theme you want to install is located in the /themes/ directory, or one of the other locations Drupal knows to look for theme code, it can be installed by following the steps below. To fetch the location of the theme and its files check out the Structure of a Theme.
Step 1: Log in
To install the theme, you need to log in as an administrator, or another user who has the authority to administer themes.
Step 2: Open the Appearance page
In the Manage administrative menu, pinpoint Appearance available in the admin panel. This is the main location for configuring themes and their settings.
Step 3: Locate the theme
Pinpoint the theme that you would like to enable from the list of themes on the Appearance page.
Step 4: Set as default
If the theme is already installed, click the link labeled set as default.
Step 5: Or install and set it as default
In case, if the theme is not installed yet, click the Install button and set it as the default link for the theme that you like to use.
Step 6: Verify it worked
Navigate to the homepage or any other landing page on your site, and you should see that your new theme is active.
Install a theme using Drush
Step 1: Navigate the project name for the theme you want to install, which is the last segment of the theme�s project page URL. For example, if the project URL is https://www.drupal.org/project/newproject, the project name is newproject.
Step 2: Download the theme using either the steps, �Manually Downloading Module or Theme Files�, or �Using Composer to Download and Update Files�.
Step 3: Run the below Drush commands and give the project name (for example, newproject) as a parameter:
drush theme:enable newproject
drush config:set system.theme default newproject
Step 4: Follow the instructions on the screen.