diff --git a/CHANGELOG.md b/CHANGELOG.md index bc90a20..769b1fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Unreleased + +# 2.0.2 - Fix typo in `src/control.rs`. +- Replace `atty` dependency with `is-terminal`. # 2.0.1 (July 3, 2023) - Add edition for future compatibility. diff --git a/Cargo.toml b/Cargo.toml index 94d3f78..70eb639 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "colored" description = "The most simple way to add colors in your terminal" -version = "2.0.1" +version = "2.0.2" edition = "2021" authors = ["Thomas Wickham "] license = "MPL-2.0" @@ -15,7 +15,7 @@ keywords = ["color", "string", "term", "ansi_term", "term-painter"] no-color = [] [dependencies] -atty = "0.2" +is-terminal = "0.4" lazy_static = "1" [target.'cfg(windows)'.dependencies.winapi] diff --git a/src/control.rs b/src/control.rs index 955aa2d..51ed37c 100644 --- a/src/control.rs +++ b/src/control.rs @@ -1,7 +1,9 @@ //! A couple of functions to enable and disable coloring. +use is_terminal::IsTerminal; use std::default::Default; use std::env; +use std::io; use std::sync::atomic::{AtomicBool, Ordering}; /// Sets a flag to the console to use a virtual terminal environment. @@ -105,7 +107,7 @@ impl ShouldColorize { pub fn from_env() -> Self { ShouldColorize { clicolor: ShouldColorize::normalize_env(env::var("CLICOLOR")).unwrap_or(true) - && atty::is(atty::Stream::Stdout), + && io::stdout().is_terminal(), clicolor_force: ShouldColorize::resolve_clicolor_force( env::var("NO_COLOR"), env::var("CLICOLOR_FORCE"), diff --git a/src/lib.rs b/src/lib.rs index 54affaa..9ceabd4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -25,7 +25,7 @@ //! #![warn(missing_docs)] -extern crate atty; +extern crate is_terminal; #[macro_use] extern crate lazy_static; #[cfg(windows)]