adding class to drupal8 taxonomy i want to add custom class for each term

function sometheme_preprocess_field(&amp;$variables) {
  if ($variables ['links']['#title'] == "Consulting"){
    // I'm lost here // how can i assign class here or even add a custom picture // Please help
  }
}
You can use preprocess field hook which is supported in drupal 8 also . Example below:

function example_preprocess_field(&amp;$variables) {
    if (($variables['element']['#field_name'] == 'example')) {
    //get the value of the field
    dsm($variables);
    // add a class to the field        
    $variables['attributes']['class'] = [
     'example'
      ];
  }
}