Fix color parsing (#6234)

Signed-off-by: nibon7 <nibon7@163.com>
This commit is contained in:
nibon7 2022-08-05 19:30:44 +08:00 committed by GitHub
parent c07835f3ad
commit d255a2a050
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -11,12 +11,12 @@ pub struct NuStyle {
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"),
Some(fg) => color_from_hex(&fg).unwrap_or_default(),
_ => None,
};
// get the nu_ansi_term::Color background color
let bg_color = match nu_style.bg {
Some(bg) => color_from_hex(&bg).expect("error with background color"),
Some(bg) => color_from_hex(&bg).unwrap_or_default(),
_ => None,
};
// get the attributes