mirror of
https://github.com/veeso/termscp.git
synced 2025-12-07 09:36:00 -08:00
Use default color if Text span part is Reset
This commit is contained in:
@@ -61,7 +61,6 @@ impl AuthActivity {
|
|||||||
super::COMPONENT_TEXT_FOOTER,
|
super::COMPONENT_TEXT_FOOTER,
|
||||||
Box::new(Text::new(
|
Box::new(Text::new(
|
||||||
PropsBuilder::default()
|
PropsBuilder::default()
|
||||||
.with_foreground(Color::White)
|
|
||||||
.with_texts(TextParts::new(
|
.with_texts(TextParts::new(
|
||||||
None,
|
None,
|
||||||
Some(vec![
|
Some(vec![
|
||||||
@@ -158,7 +157,8 @@ impl AuthActivity {
|
|||||||
super::COMPONENT_TEXT_NEW_VERSION,
|
super::COMPONENT_TEXT_NEW_VERSION,
|
||||||
Box::new(Text::new(
|
Box::new(Text::new(
|
||||||
PropsBuilder::default()
|
PropsBuilder::default()
|
||||||
.with_texts(TextParts::new(None, Some(vec![TextSpanBuilder::new(format!("TermSCP {} is now available! Download it from <https://github.com/veeso/termscp/releases/latest>", version).as_str()).with_foreground(Color::Yellow).bold().build()])))
|
.with_foreground(Color::Yellow)
|
||||||
|
.with_texts(TextParts::new(None, Some(vec![TextSpan::from(format!("TermSCP {} is now available! Download it from <https://github.com/veeso/termscp/releases/latest>", version))])))
|
||||||
.build()
|
.build()
|
||||||
))
|
))
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ use super::{Canvas, Component, InputEvent, Msg, Payload, Props, PropsBuilder};
|
|||||||
// ext
|
// ext
|
||||||
use tui::{
|
use tui::{
|
||||||
layout::Rect,
|
layout::Rect,
|
||||||
style::Style,
|
style::{Color, Style},
|
||||||
text::{Span, Spans, Text as TuiText},
|
text::{Span, Spans, Text as TuiText},
|
||||||
widgets::Paragraph,
|
widgets::Paragraph,
|
||||||
};
|
};
|
||||||
@@ -64,12 +64,21 @@ impl Component for Text {
|
|||||||
Some(rows) => rows
|
Some(rows) => rows
|
||||||
.iter()
|
.iter()
|
||||||
.map(|x| {
|
.map(|x| {
|
||||||
|
// Keep line color, or use default
|
||||||
|
let fg: Color = match x.fg {
|
||||||
|
Color::Reset => self.props.foreground,
|
||||||
|
_ => x.fg,
|
||||||
|
};
|
||||||
|
let bg: Color = match x.bg {
|
||||||
|
Color::Reset => self.props.background,
|
||||||
|
_ => x.bg,
|
||||||
|
};
|
||||||
Span::styled(
|
Span::styled(
|
||||||
x.content.clone(),
|
x.content.clone(),
|
||||||
Style::default()
|
Style::default()
|
||||||
.add_modifier(x.get_modifiers())
|
.add_modifier(x.get_modifiers())
|
||||||
.fg(x.fg)
|
.fg(fg)
|
||||||
.bg(x.bg),
|
.bg(bg),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
.collect(),
|
.collect(),
|
||||||
|
|||||||
Reference in New Issue
Block a user