From 97369e7b184c789584ad9a39f00813a9686e70b3 Mon Sep 17 00:00:00 2001 From: Anton Tarasenko Date: Thu, 23 Jun 2022 03:09:08 +0700 Subject: [PATCH] Add `ChangeDefaultColor()` method to MutableText --- sources/Text/MutableText.uc | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/sources/Text/MutableText.uc b/sources/Text/MutableText.uc index c5829f2..05d8600 100644 --- a/sources/Text/MutableText.uc +++ b/sources/Text/MutableText.uc @@ -413,8 +413,8 @@ public final function MutableText ReplaceS( * Sets `newFormatting` for every non-formatted character in * the caller `MutableText`. * - * @param newFormatting Formatting to use for all non-formatted character in - * the caller `MutableText`. If `newFormatting` is not colored itself - + * @param newFormatting Formatting to use for all non-formatted characters + * in the caller `MutableText`. If `newFormatting` is not colored itself - * method does nothing. * @return Returns caller `MutableText`, to allow for method chaining. */ @@ -425,6 +425,19 @@ public final function MutableText ChangeDefaultFormatting( 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 * `[startIndex; startIndex + maxLength - 1]` to `newFormatting` parameter.