Skip to content

Commit 02cc0e0

Browse files
committed
Replace 'atty' dependency with 'is-terminal'
1 parent 24ba05b commit 02cc0e0

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# 1.9.4 (July 24, 2023)
2+
- Replace 'atty' dependency with 'is-terminal'
13

24
# 1.9.3 (February 24, 2020)
35
- Fix compilation regression for 1.34.0. Thanks @jlevon for reporting.

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "colored"
33
description = "The most simple way to add colors in your terminal"
4-
version = "1.9.2"
4+
version = "1.9.4"
55
authors = ["Thomas Wickham <[email protected]>"]
66
license = "MPL-2.0"
77
homepage = "https://github.com/mackwic/colored"
@@ -14,8 +14,8 @@ keywords = ["color", "string", "term", "ansi_term", "term-painter"]
1414
no-color = []
1515

1616
[dependencies]
17-
atty = "0.2.11"
18-
lazy_static = "1.4.0"
17+
is-terminal = "0.4"
18+
lazy_static = "1"
1919

2020
[target.'cfg(windows)'.dependencies.winapi]
2121
version = "0.3"

src/control.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
//! A couple of functions to enable and disable coloring.
22
3+
use is_terminal::IsTerminal;
34
use std::default::Default;
45
use std::env;
6+
use std::io;
57
use std::sync::atomic::{AtomicBool, Ordering};
68

79
/// Sets a flag to the console to use a virtual terminal environment.
@@ -105,7 +107,7 @@ impl ShouldColorize {
105107
pub fn from_env() -> Self {
106108
ShouldColorize {
107109
clicolor: ShouldColorize::normalize_env(env::var("CLICOLOR")).unwrap_or_else(|| true)
108-
&& atty::is(atty::Stream::Stdout),
110+
&& io::stdout().is_terminal(),
109111
clicolor_force: ShouldColorize::resolve_clicolor_force(
110112
env::var("NO_COLOR"),
111113
env::var("CLICOLOR_FORCE"),

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
//!
2424
#![warn(missing_docs)]
2525

26-
extern crate atty;
26+
extern crate is_terminal;
2727
#[macro_use]
2828
extern crate lazy_static;
2929
#[cfg(windows)]

0 commit comments

Comments
 (0)