This is one of the major design points I tried to solve with https://docs.rs/stylish too, it completely decouples applying attributes to a string from encoding those attributes for an output.
https://www.reddit.com/r/rust/comments/zwohop/what_is_your_favorite_terminal_colors_library/j1yhb87/?context=3
https://www.reddit.com/r/rust/comments/zwohop/what_is_your_favorite_terminal_colors_library/j1yhb87/?context=3