Skip to content

Commit

Permalink
Replace 'atty' dependency with 'is-terminal'
Browse files Browse the repository at this point in the history
  • Loading branch information
hwittenborn committed Jul 24, 2023
1 parent 24ba05b commit 02cc0e0
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# 1.9.4 (July 24, 2023)
- Replace 'atty' dependency with 'is-terminal'

# 1.9.3 (February 24, 2020)
- Fix compilation regression for 1.34.0. Thanks @jlevon for reporting.
Expand Down
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "colored"
description = "The most simple way to add colors in your terminal"
version = "1.9.2"
version = "1.9.4"
authors = ["Thomas Wickham <mackwic@gmail.com>"]
license = "MPL-2.0"
homepage = "https://github.com/mackwic/colored"
Expand All @@ -14,8 +14,8 @@ keywords = ["color", "string", "term", "ansi_term", "term-painter"]
no-color = []

[dependencies]
atty = "0.2.11"
lazy_static = "1.4.0"
is-terminal = "0.4"
lazy_static = "1"

[target.'cfg(windows)'.dependencies.winapi]
version = "0.3"
Expand Down
4 changes: 3 additions & 1 deletion src/control.rs
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -105,7 +107,7 @@ impl ShouldColorize {
pub fn from_env() -> Self {
ShouldColorize {
clicolor: ShouldColorize::normalize_env(env::var("CLICOLOR")).unwrap_or_else(|| true)
&& atty::is(atty::Stream::Stdout),
&& io::stdout().is_terminal(),
clicolor_force: ShouldColorize::resolve_clicolor_force(
env::var("NO_COLOR"),
env::var("CLICOLOR_FORCE"),
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
//!
#![warn(missing_docs)]

extern crate atty;
extern crate is_terminal;
#[macro_use]
extern crate lazy_static;
#[cfg(windows)]
Expand Down

0 comments on commit 02cc0e0

Please sign in to comment.