-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Colours don't work in command prompt on Windows #56
Comments
Running my exe with this crate, in the integrated powershell terminal in vs code on windows, if I run via |
For what its worth, I added this to the top of my #[cfg(windows)] unsafe {
let handle = winapi::um::processenv::GetStdHandle(winapi::um::winbase::STD_OUTPUT_HANDLE);
let mut original_mode: winapi::shared::minwindef::DWORD = 0;
winapi::um::consoleapi::GetConsoleMode(handle, &mut original_mode);
winapi::um::consoleapi::SetConsoleMode(handle, winapi::um::wincon::ENABLE_VIRTUAL_TERMINAL_PROCESSING | original_mode);
} |
Hi @noxabellus and @woubuc, there is already a function to do that: It doesn't show up in the docs unless you set the platform to windows |
The colours are displayed as code in the standard command prompt on Windows 10.
What it looks like:

What it should look like (using Cmder):

Code used
I know the cmd supports colours, since Cargo displays colours just fine.
The text was updated successfully, but these errors were encountered: