How to add custom theme configuration fields in shopware 5?

To add custom theme configuration fields in shopware 5 follow the below steps:

Step 1: Go to shopware theme directory of your website.

Step 2: Click on the Theme.php file to add the configuration field.

This image has an empty alt attribute; its file name is Screenshot_1-1.png

Step 3: Add below code in Theme.php file.

use Shopware\Components\Form as Form;  //container element

/**
 * @param Form\Container\TabContainer $container
 */
public function createConfig(Form\Container\TabContainer $container)
{
// Create the fieldset which is the container of our field
$fieldset = $this->createFieldSet(
'my_custom_settings',
 'My custom settings'
);

 // Create the textfield
$textField = $this->createTextField(
'basic_font_size',
 'Basic font size',
 '16px'
);

 // Create the color picker field
$colorPickerField = $this->createColorPickerField(
'custom-color-main',
 'Main color',
 '#62b74b'
);

 // Adding the fields to the fieldset
$fieldset->addElement($textField);
 $fieldset->addElement($colorPickerField);

 // Create the tab which will be named "My custom colors"
$tab = $this->createTab(
'my_custom_tab',
 'My custom tab'
);

 // add the fieldset to the tab
$tab->addElement($fieldset);

 // add the tab to the container, which is a tab panel.
$container->addTab($tab);
}

Step 4: Now go to the theme section of the backend and click on the Configure theme.

This image has an empty alt attribute; its file name is Screenshot_2-1-980x450.png

Step 5: Now you can see the newly created My custom tab just like below screenshot.

Result: