Set value to specific custom theme setting
Drupal 8 use configuration to store configuration settings. You can follow document. And snippet code to set new value for custom theme(replace theme_name with your theme name).

$config = \Drupal::service('config.factory')-&gt;getEditable('theme_name.settings');
$config-&gt;set('variable', 'value')-&gt;save();