Modifying page title with THEME_preprocess_page_title
I think you are looking in wrong place. As far as i remember, in Drupal 8 title is rendered trough block called page_title_block

function MODULE_preprocess_block(&amp;$variables) {
  if ($variables['plugin_id'] == 'page_title_block') {
    $color_title = str_ireplace('some text', 'Some &lt;span class="ct-green"&gt;TEXT&lt;/span&gt;', $variables['content']['#title']);
    $variables['content']['#title'] = $color_title;
  }
}