1
0
mirror of https://github.com/sharkdp/bat.git synced 2025-10-04 02:52:32 +01:00

Use nu-ansi-term instead of ansi_term

The `nu-ansi-term` crate is a fork of `ansi_term` which is maintained by
the Nushell project.
This commit is contained in:
Constantin Nickel
2023-03-23 10:47:38 +01:00
parent d20405b975
commit da3aa4e2fd
9 changed files with 23 additions and 23 deletions

View File

@@ -1,9 +1,9 @@
use ansi_term::Color::{self, Fixed, RGB};
use ansi_term::{self, Style};
use nu_ansi_term::Color::{self, Fixed, Rgb};
use nu_ansi_term::{self, Style};
use syntect::highlighting::{self, FontStyle};
pub fn to_ansi_color(color: highlighting::Color, true_color: bool) -> Option<ansi_term::Color> {
pub fn to_ansi_color(color: highlighting::Color, true_color: bool) -> Option<nu_ansi_term::Color> {
if color.a == 0 {
// Themes can specify one of the user-configurable terminal colors by
// encoding them as #RRGGBBAA with AA set to 00 (transparent) and RR set
@@ -38,7 +38,7 @@ pub fn to_ansi_color(color: highlighting::Color, true_color: bool) -> Option<ans
// 01. The built-in theme ansi uses this.
None
} else if true_color {
Some(RGB(color.r, color.g, color.b))
Some(Rgb(color.r, color.g, color.b))
} else {
Some(Fixed(ansi_colours::ansi256_from_rgb((
color.r, color.g, color.b,