Open sk-Prime opened 5 years ago
Hi @sk-Prime,
What version of Windows are you running? Which console?
I believe the virtual terminal sequence support is only available in Windows 10.
in windows seven it doesn't work. but colour crate perfectly works. but i liked colored approach.
Yes, I can confirm it doesn't work on windows. Could this be mentioned in the README until it's fixed ?
im using Windows 10 with devmode on. doesnt work on Windows Terminal neither on CMD.
Same issue. Both in cmd and PowerShell. Fresh Windows 10 installation.
Hi all,
Could you please provide details about your OS, what shell/terminal you are using, an example of your code that does not work and a screenshot with the output showing it not working. Even the Rust toolchain you are using could be the issue.
I ask for this information as I am unable to reproduce on my machine, and in my experience with Rust production code, running on many machines (all Windows 10) that use colored
there have been no issues when using the set_virtual_terminal
flag.
It works for me in the Command Prompt
and Powershell. Windows 10.0.19042.928.
I have encountered the same issue. When I run "cargo run" while developing, it works perfectly, even with cmd.exe. However, with the compiled binary, whether debug or release mode, whether cmd or powershell, the control chars are displayed instead of color.
Oh I think I find the answer. As the doc of ansi_term suggests, On Windows 10, the application must enable ANSI support first: let enabled = ansi_term::enable_ansi_support();
Oh I think I find the answer. As the doc of ansi_term suggests, On Windows 10, the application must enable ANSI support first:
let enabled = ansi_term::enable_ansi_support();
@constituent did you try using https://docs.rs/colored/2.0.0/x86_64-pc-windows-msvc/colored/control/fn.set_virtual_terminal.html?
Oh I think I find the answer. As the doc of ansi_term suggests, On Windows 10, the application must enable ANSI support first:
let enabled = ansi_term::enable_ansi_support();
@constituent did you try using https://docs.rs/colored/2.0.0/x86_64-pc-windows-msvc/colored/control/fn.set_virtual_terminal.html?
I can't quite remember, but probably not
And as I tried just now, set_virtual_terminal
works as fine as ansi_term::enable_ansi_support
for me
This is working well for me:
fn main() {
if cfg!(target_os = "windows") {
control::set_virtual_terminal(true).unwrap();
}
...
}
It is showing numbers rather than color. in this case
blue
Though i have added control::set_virtual_terminal(true); in my source file.