how to get each character of a textblock of different color in wpf?
Use many different runs:
<TextBlock FontSize="22">
<Run Foreground="Gold">H</Run>
<Run Foreground="Maroon">e</Run>
<Run Foreground="Blue">l</Run>
<Run Foreground="Orange">l</Run>
<Run Foreground="Brown">o</Run>
</TextBlock>
This produce the result:

You can compose colors by adding each color as a new textbook for example:
TextBlock printTextBlock = new TextBlock();
printTextBlock.Foreground = Brushes.Red;
printTextBlock.Text = "This text will colored with red";
StackPanel.Children.Add(printTextBlock);
The same for the rest of the text.
来源:https://stackoverflow.com/questions/5535619/wpf-textblock-color-for-each-character