add ability to specify an ansi style (#595)

* add ability to specify an ansi style

* remove comments

* remove more debug code

* some cleanup and refactoring
This commit is contained in:
Darren Schroeder
2021-12-27 08:59:55 -06:00
committed by GitHub
parent 1dbf351425
commit 1837acfc70
2 changed files with 88 additions and 37 deletions

View File

@ -2,13 +2,13 @@ use nu_ansi_term::{Color, Style};
use serde::Deserialize;
#[derive(Deserialize, PartialEq, Debug)]
struct NuStyle {
fg: Option<String>,
bg: Option<String>,
attr: Option<String>,
pub struct NuStyle {
pub fg: Option<String>,
pub bg: Option<String>,
pub attr: Option<String>,
}
fn parse_nustyle(nu_style: NuStyle) -> Style {
pub fn parse_nustyle(nu_style: NuStyle) -> Style {
// get the nu_ansi_term::Color foreground color
let fg_color = match nu_style.fg {
Some(fg) => color_from_hex(&fg).expect("error with foreground color"),