How to use with std::io::stdout?
medakk opened this issue · comments
Karthik Karanth commented
The library works fine when I am using print!
or println!
. But when writing to stdout, like:
let mut stdout = stdout();
let s = "Hello\n".truecolor(200, 50, 50);
stdout.write(s.as_bytes());
stdout.flush();
I see only regular black-and-white text. How do I get the library to work with stdout?
Karthik Karanth commented
never mind, I figure it out:
stdout.write(s.to_string().as_bytes())
Spenser Black commented
You might also want to check out the write!
macro.
This should work fine
write!(stdout, "{}", "Hello".truecolor(200, 50, 50));