@@ -440,6 +440,7 @@ impl FromStr for Modifier {
440440pub struct Style {
441441 pub fg: Option<Color>,
442442 pub bg: Option<Color>,
443+ pub underline: Option<Color>,
443444 pub add_modifier: Modifier,
444445 pub sub_modifier: Modifier,
445446}
@@ -449,6 +450,7 @@ impl Default for Style {
449450 Style {
450451 fg: None,
451452 bg: None,
453+ underline: None,
452454 add_modifier: Modifier::empty(),
453455 sub_modifier: Modifier::empty(),
454456 }
@@ -461,6 +463,7 @@ impl Style {
461463 Style {
462464 fg: Some(Color::Reset),
463465 bg: Some(Color::Reset),
466+ underline: Some(Color::Reset),
464467 add_modifier: Modifier::empty(),
465468 sub_modifier: Modifier::all(),
466469 }
@@ -496,6 +499,21 @@ impl Style {
496499 self
497500 }
498501
502+ /// Changes the underline color.
503+ ///
504+ /// ## Examples
505+ ///
506+ /// ```rust
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));
511+ /// ```
512+ pub fn underline(mut self, color: Color) -> Style {
513+ self.underline = Some(color);
514+ self
515+ }
516+
499517 /// Changes the text emphasis.
500518 ///
501519 /// When applied, it adds the given modifier to the `Style` modifiers.
@@ -552,6 +570,7 @@ impl Style {
552570 pub fn patch(mut self, other: Style) -> Style {
553571 self.fg = other.fg.or(self.fg);
554572 self.bg = other.bg.or(self.bg);
573+ self.underline = other.underline.or(self.underline);
555574
556575 self.add_modifier.remove(other.sub_modifier);
557576 self.add_modifier.insert(other.add_modifier);