Skip to content

incorrect colors when using nested styling #45

@LordMZTE

Description

@LordMZTE

When using multiple nested colored strings, like this:

use owo_colors::{AnsiColors, OwoColorize};

fn main() {
    println!(
        "{}",
        format!("TEST {} TEST", "TEST".color(AnsiColors::Red)).color(AnsiColors::Green)
    );
}

the color ends up getting reset in the middle of the string.

This means that the this is going to print test strings of these colors: green, red, white. But in this example, I'd expect green, red, green.

I'm assuming this is happening because the coloring doesn't take into account the reset escape sequence in the inner string.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions