diff --git a/Cargo.lock b/Cargo.lock index 2e63b21f..574932a0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -663,17 +663,6 @@ dependencies = [ "wasm-bindgen-futures", ] -[[package]] -name = "colored" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3616f750b84d8f0de8a58bda93e08e2a81ad3f523089b05f1dffecab48c6cbd" -dependencies = [ - "atty", - "lazy_static", - "winapi", -] - [[package]] name = "console" version = "0.14.1" @@ -1467,7 +1456,6 @@ name = "ethers-solc" version = "0.17.0" dependencies = [ "cfg-if 1.0.0", - "colored", "criterion", "dunce", "env_logger", @@ -1500,6 +1488,7 @@ dependencies = [ "tracing", "tracing-subscriber", "walkdir", + "yansi", ] [[package]] diff --git a/ethers-solc/Cargo.toml b/ethers-solc/Cargo.toml index 439eab54..fd103ba5 100644 --- a/ethers-solc/Cargo.toml +++ b/ethers-solc/Cargo.toml @@ -26,7 +26,7 @@ regex = "1.6.0" md-5 = "0.10.2" thiserror = "1.0" hex = "0.4.3" -colored = "2.0.0" +yansi = "0.5.1" glob = "0.3.0" tracing = "0.1.36" num_cpus = "1.13.1" diff --git a/ethers-solc/src/artifacts/mod.rs b/ethers-solc/src/artifacts/mod.rs index e132e32f..d27c1331 100644 --- a/ethers-solc/src/artifacts/mod.rs +++ b/ethers-solc/src/artifacts/mod.rs @@ -2,7 +2,6 @@ use crate::{ compile::*, error::SolcIoError, remappings::Remapping, utils, ProjectPathsConfig, SolcError, }; -use colored::Colorize; use ethers_core::abi::Abi; use md5::Digest; use semver::{Version, VersionReq}; @@ -14,6 +13,7 @@ use std::{ str::FromStr, }; use tracing::warn; +use yansi::Paint; pub mod ast; pub use ast::*; @@ -1687,15 +1687,15 @@ impl fmt::Display for Error { match self.severity { Severity::Error => { if let Some(code) = self.error_code { - format!("error[{}]: ", code).as_str().red().fmt(f)?; + Paint::red(format!("error[{}]: ", code)).fmt(f)?; } - msg.as_str().red().fmt(f) + Paint::red(msg).fmt(f) } Severity::Warning | Severity::Info => { if let Some(code) = self.error_code { - format!("warning[{}]: ", code).as_str().yellow().fmt(f)?; + Paint::yellow(format!("warning[{}]: ", code)).fmt(f)?; } - msg.as_str().yellow().fmt(f) + Paint::yellow(msg).fmt(f) } } } else { @@ -1715,8 +1715,8 @@ pub enum Severity { impl fmt::Display for Severity { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { - Severity::Error => f.write_str(&"Error".red()), - Severity::Warning => f.write_str(&"Warning".yellow()), + Severity::Error => Paint::red("Error").fmt(f), + Severity::Warning => Paint::yellow("Warning").fmt(f), Severity::Info => f.write_str("Info"), } }