RichTextKit icon indicating copy to clipboard operation
RichTextKit copied to clipboard

TextColor of RichString method does not work after construction

Open zhangyiatmicrosoft opened this issue 1 year ago • 2 comments

This works: var rs = new RichString().Add("Hello world", textColor: SKColors.Red);

This does not and text is still black. Am I missing anything? var rs = new RichString().Add("Hello world"); rs.TextColor(SKColors.Green);

zhangyiatmicrosoft avatar Feb 14 '24 17:02 zhangyiatmicrosoft

Set the text color first. Basically you do the setup for the text first then add the text after the setup is done:

var rs = new RichString().TextColor(SKColors.Green);
rs.Add("Hello world");

gbreen12 avatar May 02 '25 18:05 gbreen12

The reply from @gbreen12 is correct. The RichString fluent API uses methods to set attributes for subsequently added text - not the text already added.

toptensoftware avatar May 05 '25 01:05 toptensoftware