diff options
Diffstat (limited to 'src/main/kotlin/moe/nea/firmament/util/textutil.kt')
-rw-r--r-- | src/main/kotlin/moe/nea/firmament/util/textutil.kt | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/main/kotlin/moe/nea/firmament/util/textutil.kt b/src/main/kotlin/moe/nea/firmament/util/textutil.kt index cfe548d..5f9379a 100644 --- a/src/main/kotlin/moe/nea/firmament/util/textutil.kt +++ b/src/main/kotlin/moe/nea/firmament/util/textutil.kt @@ -7,9 +7,11 @@ package moe.nea.firmament.util +import net.minecraft.text.MutableText import net.minecraft.text.PlainTextContent import net.minecraft.text.Text import net.minecraft.text.TranslatableTextContent +import net.minecraft.util.Formatting import moe.nea.firmament.Firmament @@ -96,6 +98,8 @@ val Text.unformattedString: String get() = string.removeColorCodes() +fun MutableText.withColor(formatting: Formatting) = this.styled { it.withColor(formatting) } + fun Text.transformEachRecursively(function: (Text) -> Text): Text { val c = this.content if (c is TranslatableTextContent) { |