@@ -440,6 +440,7 @@ impl FromStr for Modifier {
440pub struct Style {
440pub struct Style {
441 pub fg: Option<Color>,
441 pub fg: Option<Color>,
442 pub bg: Option<Color>,
442 pub bg: Option<Color>,
443+ pub underline: Option<Color>,
443 pub add_modifier: Modifier,
444 pub add_modifier: Modifier,
444 pub sub_modifier: Modifier,
445 pub sub_modifier: Modifier,
@@ -449,6 +450,7 @@ impl Default for Style {
450 fg: None,
451 fg: None,
451 bg: None,
452 bg: None,
452 add_modifier: Modifier::empty(),
454 add_modifier: Modifier::empty(),
453 sub_modifier: Modifier::empty(),
455 sub_modifier: Modifier::empty(),
@@ -461,6 +463,7 @@ impl Style {
462 fg: Some(Color::Reset),
464 fg: Some(Color::Reset),
463 bg: Some(Color::Reset),
465 bg: Some(Color::Reset),
466+ underline: Some(Color::Reset),
464 add_modifier: Modifier::empty(),
467 add_modifier: Modifier::empty(),
465 sub_modifier: Modifier::all(),
468 sub_modifier: Modifier::all(),
@@ -496,6 +499,21 @@ impl Style {
502+ /// Changes the underline color.
507+ /// # use helix_view::graphics::{Color, Style};
508+ /// let style = Style::default().underline(Color::Blue);
509+ /// let diff = Style::default().underline(Color::Red);
510+ /// assert_eq!(style.patch(diff), Style::default().underline(Color::Red));
512+ pub fn underline(mut self, color: Color) -> Style {
513+ self.underline = Some(color);
499 /// Changes the text emphasis.
517 /// Changes the text emphasis.
501 /// When applied, it adds the given modifier to the `Style` modifiers.
519 /// When applied, it adds the given modifier to the `Style` modifiers.
@@ -552,6 +570,7 @@ impl Style {
552 pub fn patch(mut self, other: Style) -> Style {
570 pub fn patch(mut self, other: Style) -> Style {
553 self.fg = other.fg.or(self.fg);
571 self.fg = other.fg.or(self.fg);
554 self.bg = other.bg.or(self.bg);
572 self.bg = other.bg.or(self.bg);
573+ self.underline = other.underline.or(self.underline);
556 self.add_modifier.remove(other.sub_modifier);
575 self.add_modifier.remove(other.sub_modifier);
557 self.add_modifier.insert(other.add_modifier);
576 self.add_modifier.insert(other.add_modifier);