Change:
does not emit color output when running under a tmux session with set correctly to (supported by the latest versions of ncurses) even with when is set to . On the machine in question (macOS) the term file for is installed and returns the following: Per cargo should be invoking rustc with the flag, and indeed, returns 'Option color given more than once. Executing also does not produce color output, but does.
I have a similar bug on Archlinux. I used to get colored output on this system, but that recently stopped working for rustc. (Cargo is still fine for me.) If I add in and run in , I get Result::unwrap()Err/lib/terminfo/x/xterm-256colorncursesNEWS file does mention a new (incompatible) file format with a different magic number: Could rustc switch to whatever Cargo uses for colored terminal output?
A work-around for my machine was temporarily downgrading the packages, and copying the old file to .
Yes rustc should be able to switch at any time
Thanks for the workaround!
Changing from to also seems to work as a temporary workaround. (note: this may affect other terminal applications)
Another work-around if you're using sh: This sets to a possibly incorrect value, but limits its impact to only the output of a command.
That worked for me as well. I had no colour with . I downgraded to , which was what I had in , and now I have colour again.
I have a similar issue: In my regular terminal emulator (not tmux), there are no colors from rustc (as executed with ), colors from cargo itself are working fine. The default setting for there is: . The problem is fixed by setting to . Inside tmux however, colors work just fine, there seems to be by default.
Colors are fixed in the latest nightly (thanks to o/)
This is fixed for me in today’s nigthly, presumably by
With the current nightly I still have no colors with and have to use as a work around. What might still be broken?
Terminal colors are still broken with . however, does use colors, so there's clearly still a discrepancy between how and use termcolor
It works fine for me with ncurses 6.1, even rustup has colors again since the last version . I’d like to note though that things like destroy this for some reason (even if is set). It took me some time to figure that out
I'm using ncurses 6.1 on Fedora 28 and everything appears to be working fine except for test colors. In mentioned that a bit tricky due to how the build works, but we can always tackle that later. What is the barrier to migrating libtest from to ? For now, it's leaving my test output looking like this. !
I have an in-progress patch for libtest but I ran into I'm guessing that's the build issue that is referring to. I don't know how linking libtest works, but I'm happy to try to fix the build if someone can point me in the right direction.

Discussion:
#[allow(missing_docs)] pub mod color { /// Number for a terminal color <del> pub type Color = u16; </del> <ins> pub type Color = u32; </ins> pub const BLACK: Color = 0; pub const RED: Color = 1;

/// Map of capability name to boolean value pub bools: HashMap<String, bool>, /// Map of capability name to numeric value <del> pub numbers: HashMap<String, u16>, </del> <ins> pub numbers: HashMap<String, u32>, </ins> /// Map of capability name to raw (unexpanded) string pub strings: HashMap<String, Vec<u8>>, }

/// A Terminal that knows how many colors it supports, with a reference to its /// parsed Terminfo database record. pub struct TerminfoTerminal<T> { <del> num_colors: u16, </del> <ins> num_colors: u32, </ins> out: T, ti: TermInfo, }

fn read_le_u16(r: &mut dyn io::Read) -> io::Result<u16> { let mut b = [0; 2]; <del> let mut amt = 0; while amt < b.len() { match r.read(&mut b[amt..])? { 0 => return Err(io::Error::new(io::ErrorKind::Other, "end of file")), n => amt += n, } } </del> <ins> r.read_exact(&mut b)?; </ins> Ok((b[0] as u16) | ((b[1] as u16) << 8)) } <ins> fn read_le_u32(r: &mut dyn io::Read) -> io::Result<u32> { let mut b = [0; 4]; r.read_exact(&mut b)?; Ok((b[0] as u32) | ((b[1] as u32) << 8) | ((b[2] as u32) << 16) | ((b[3] as u32) << 24)) } </ins> fn read_byte(r: &mut dyn io::Read) -> io::Result<u8> { match r.bytes().next() { Some(s) => s,

// Check magic number let magic = t!(read_le_u16(file)); <del> if magic != 0x011A { return Err(format!("invalid magic number: expected {:x}, found {:x}", 0x011A, magic)); } </del> <ins> let extended = match magic { 0o0432 => false, 0o01036 => true, _ => return Err(format!("invalid magic number, found {:o}", magic)), }; </ins> // According to the spec, these fields must be >= -1 where -1 means that the feature is not // supported. Using 0 instead of -1 works because we skip sections with length 0.

t!(read_byte(file)); // compensate for padding } <del> let numbers_map: HashMap<String, u16> = t! { (0..numbers_count).filter_map(|i| match read_le_u16(file) { Ok(0xFFFF) => None, Ok(n) => Some(Ok((nnames[i].to_string(), n))), Err(e) => Some(Err(e)) </del> <ins> let numbers_map: HashMap<String, u32> = t! { (0..numbers_count).filter_map(|i| { let number = if extended { read_le_u32(file) } else { read_le_u16(file).map(Into::into) }; match number { Ok(0xFFFF) => None, Ok(n) => Some(Ok((nnames[i].to_string(), n))), Err(e) => Some(Err(e)) } </ins> }).collect() };

strings.insert("setab".to_string(), b"x1B[4%p1%dm".to_vec()); let mut numbers = HashMap::new(); <del> numbers.insert("colors".to_string(), 8u16); </del> <ins> numbers.insert("colors".to_string(), 8); </ins> TermInfo { names: vec!["cygwin".to_string()], // msys is a fork of an older cygwin version

_ => unreachable!(), }; <del> color | (bits & 0x8) // copy the hi-intensity bit </del> <ins> color | (u32::from(bits) & 0x8) // copy the hi-intensity bit </ins> } impl<T: Write + Send + 'static> WinConsole<T> {