For coloring text inside text widgets #323
vikash0705
started this conversation in
General
Replies: 1 comment
-
Hi @vikash0705, we can certainly introduce new ways of doing this. I don't fully understand the examples provided, since the two blocks of code do different things. The first one applies the same color to the entire text, the second one uses multiple colors. As you likely know - adding a text with a single color can already be done with a single call to I am assuming this discussion is about adding text with multiple colors. Can you help me to understand the problem we are trying to solve? Why is it a problem to call the Write function multiple times? Once I understand the problem, we can try to discuss alternatives. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Can't we use any other colouring modules that gives us coloured text?
This way we can for a chuck of string first which might have few words coloured and then render this on the text widget using a single write function call. Instead of invoking multiple write calls on the same widget to get coloured text.
Example
str = "Sample coloured text to display in red colour"
textWidget.Write(str)
Instead of doing the below
wrapped.Write("Sample")
wrapped.Write("coloured", text.WriteCellOpts(cell.FgColor(cell.ColorRed)))
wrapped.Write("text to")
wrapped.Write("display", text.WriteCellOpts(cell.FgColor(cell.ColorBlue)))
wrapped.Write("in red colour")
Any way of doing this?
Beta Was this translation helpful? Give feedback.
All reactions