A custom Drupal theme is a uniquely designed and developed visual layout for a Drupal website. Unlike pre-built or contributed themes available in the Drupal ecosystem, a custom theme is tailor-made to suit the specific needs and branding requirements of a website. It involves creating custom HTML, CSS, JavaScript, and template files to define the website's appearance and layout.
Step 1: First, we need to create a custom theme
under ‘your_project_name/themes/custom’
folder. We will name the folder as custom_theme.
Step 2: Next, we will need to create
an “your_custom_theme_name.info.yml" file. We need to specify the basic keys for it.
Step 3: Now, let’s create a your_custom_theme_name.libraries.yml file and We will also create CSS and JS directory and its files to it in here
Note: you must change the css and js according to your design and requirements
Step 4: After creating the libraries.yml file we are link to this file to the theme that why we are link this file to info.yml file
Step 5: Now, we will define the ‘regions’ for our theme. In “info.yml”
Step 6: After define the regions we are creating “page.html.twig” file in folder of template in your directory just like blow
Step 7: Now you go ‘appearance’ in your drupal project to see the custme theme and install tha theme
After it is installed the theme and go to ‘Structure -> Block Layout.’ Your Custom Theme will appear under the Block Layout.
➢ You are now almost done with theming in Drupal 10
Step 7: If you need to write any hooks or create suggestions for your twig file, you could add the “your_theme_name.theme” file in your custom Drupal theme (shown below).