Paintbrush supports unlimited levels of nesting, allowing you to use one color inside another color and have the text revert back to its previous color. This lets you create complex colorized strings without having to revert back manually.
Side-by-side view
Spec
subjectdo paintbrushdo green"green, #{blue"blue, #{cyan"cyan #{yellow"and yellow"}, back to cyan"}, back to blue"}, and back to green" end end
it{is_expected.toinclude"and yellow"}
Output
green, blue, cyan and yellow, back to cyan, back to blue, and back to green
subjectdo paintbrushdo green"green, #{blue"blue, #{cyan"cyan #{yellow"and yellow"}, back to cyan"}, back to blue"}, and back to green" end end
it{is_expected.toinclude"and yellow"}
green, blue, cyan and yellow, back to cyan, back to blue, and back to green