[rtext] Introducing styled texts #4818
Open
+299
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello!
I have added the ability to customize text color and background color with special characters inside the text (pretty much like mIRC does)
You can use the functions
DrawTextStyled
andDrawTextStyledEx
almost as you would useDrawText
andDrawTextEx
respectivelyThe changes are: instead of passing the Color, you will pass an array of Colors and the size of this array
Inside the text you can use
\003
to set the foreground color,\004
to set the background color,\015
to reset them to their default values (first color in array, if any, as foreground color [or black, if none], and transparent background) and\022
to swap foreground and background colorsAlso added
MeasureTextStyled
andMeasureTextStyledEx
to correctly measure them asMeasureText
andMeasureTextEx
would for plain textsIf any adjustment is needed, either to the code or to the PR, please, let me know
Thank you