makeRich

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:

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")