colored icon indicating copy to clipboard operation
colored copied to clipboard

Support storing coloured strings in other strings

Open Wilfred opened this issue 6 years ago • 5 comments

I'd expected to be able to push a coloured string into another, but it loses the colour:

fn main() {
    let mut s = String::with_capacity(5);
    let msg = "blue";
    s.push_str(&msg.blue());

    println!("{}", msg.blue()); // works
    println!("{}", s); // no colour
}

Is this supported?

Wilfred avatar Dec 24 '18 10:12 Wilfred

Ooh, this works:

    s.push_str(&msg.blue().to_string());

Perhaps mention this in the readme?

Wilfred avatar Dec 24 '18 10:12 Wilfred

Thank for the issue, it's not clear indeed.

Where would you like it to be ? In an example ? As a special case in the readme ?

mackwic avatar Jan 04 '19 14:01 mackwic

I think mentioning in it the readme would be sufficient :)

Wilfred avatar Mar 09 '19 00:03 Wilfred

+1 for docs. Looked through issues for exactly this :+1:

mfaerevaag avatar Jul 28 '20 10:07 mfaerevaag

I just ran into the same issue, v2.0.0. Seems like it could be prevented at the type level?

brundonsmith avatar Nov 15 '22 03:11 brundonsmith