Browse Source

Add `ChangeDefaultColor()` method to MutableText

pull/8/head
Anton Tarasenko 2 years ago
parent
commit
97369e7b18
  1. 17
      sources/Text/MutableText.uc

17
sources/Text/MutableText.uc

@ -413,8 +413,8 @@ public final function MutableText ReplaceS(
* Sets `newFormatting` for every non-formatted character in * Sets `newFormatting` for every non-formatted character in
* the caller `MutableText`. * the caller `MutableText`.
* *
* @param newFormatting Formatting to use for all non-formatted character in * @param newFormatting Formatting to use for all non-formatted characters
* the caller `MutableText`. If `newFormatting` is not colored itself - * in the caller `MutableText`. If `newFormatting` is not colored itself -
* method does nothing. * method does nothing.
* @return Returns caller `MutableText`, to allow for method chaining. * @return Returns caller `MutableText`, to allow for method chaining.
*/ */
@ -425,6 +425,19 @@ public final function MutableText ChangeDefaultFormatting(
return self; return self;
} }
/**
* Colors every non-formatted character in the caller `MutableText` in
* the given `defaultColor`.
*
* @param defaultColor Color to use for all non-formatted characters in
* the caller `MutableText`.
* @return Returns caller `MutableText`, to allow for method chaining.
*/
public final function MutableText ChangeDefaultColor(Color defaultColor)
{
return ChangeDefaultFormatting(_.text.FormattingFromColor(defaultColor));
}
/** /**
* Changes formatting for characters with indices in range, specified as * Changes formatting for characters with indices in range, specified as
* `[startIndex; startIndex + maxLength - 1]` to `newFormatting` parameter. * `[startIndex; startIndex + maxLength - 1]` to `newFormatting` parameter.

Loading…
Cancel
Save