make Rich
Rich text builder
Outputs a minecraft formatted text array with the form [{"text":"...","color":"...",...}, ...]
Formatting is applied using the format @<format>{text}
where <format>
is one of the following:
a plaintext color (
red
,green
,dark_red
, etc.) (see: https://minecraft.fandom.com/wiki/Formatting_codes#Color_codes)a hex color (
#ffffff
,#AbCdEf
, etc.)a formatting code (
bold
,italic
,obfuscated
, etc.) (see: https://minecraft.fandom.com/wiki/Formatting_codes#Formatting_codes)
These formats can be nested like: @red{@bold{asdf}}
.
Any @
, }
, or \
characters can be escaped using a backslash (\
).
Nested color attributes or formatting codes are ignored.
Examples:
makeRich("Hello, @red{@blue{HI}} world!") // the @blue is ignored
makeRich("Hello, @bold{@bold{HI}} world!") // the second bold is ignored
makeRich("Hello, @red{world}!")
makeRich("Hello, @bold{@red{world}!}")
makeRich("@italic{@#fa2c8b{Hello}, @bold{@red{world}!}}")
makeRich("Escaped \\@ symbol and \\\\ backslash, and \\} curly brace")
Content copied to clipboard