Taxonomy List in node/add Capitalize all letters in the parent only
You can use hook_form_alter to alter the node form. This way you don't alter the data in the vocabulary.

function modulename_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  // For 'article' content type.
  if ($form_id === 'article_node_form') {
    $lang_code = $form['language']['#value'];
    foreach ($form['field_dd'][$lang_code]['#options'] as $key =&gt; $value) {
      // Check if option starts with '-' sign. Only child starts with '-' sign.
      // If yes, then continue.
      if (strpos($value, '-') === 0) {
        continue;
      }
      // Else capitalize all the characters.
      $form['field_dd'][$lang_code]['#options'][$key] = strtoupper($value);
      // $form['field_dd'][$lang_code]['#options'][$key]['#attributes'] = array('class' =&gt; array('option-blue'));
    }
  }
}




Note:

Refer this link for your new use case: https://api.drupal.org/api/drupal/developer!topics!forms_api_reference.html/7#attributes