enable-ansi-support: Enable ANSI escape code support on Windows 10
About
This crate provides one function, enable_ansi_support
, which allows ANSI escape codes to work on Windows 10 and above. Call enable_ansi_support
once, early on in main()
, to enable ANSI escape codes generated by crates like ansi_term
or owo-colors
to work on Windows just like they do on Unix platforms.
This uses Windows API calls to alter the properties of the console that the program is running in. See the Windows documentation for more information.
On non-Windows platforms, enable_ansi_support
is a no-op.
Minimum supported Rust version
The minimum supported Rust version (MSRV) is 1.41. Unless there's a compelling reason to update it, it is most likely going to stay at 1.41 forever.
License and credits
This project is available under the terms of the MIT license. It is a derivative of ansi_term
's enable_ansi_support
(as of this snapshot) with minor modifications. The upstream code is used under the terms of the MIT license:
Copyright (c) 2014 Benjamin Sago
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.