Use new highlight colors for editor and pseudo messages
This commit is contained in:
parent
3fd08fd399
commit
01ee4b4ce8
3 changed files with 45 additions and 46 deletions
|
|
@ -23,17 +23,41 @@ pub fn style_placeholder() -> ContentStyle {
|
|||
ContentStyle::default().dark_grey()
|
||||
}
|
||||
|
||||
fn style_time(highlighted: bool) -> ContentStyle {
|
||||
if highlighted {
|
||||
ContentStyle::default().black().on_white()
|
||||
} else {
|
||||
ContentStyle::default().grey()
|
||||
}
|
||||
}
|
||||
|
||||
fn style_indent(highlighted: bool) -> ContentStyle {
|
||||
if highlighted {
|
||||
ContentStyle::default().black().on_white()
|
||||
} else {
|
||||
ContentStyle::default().dark_grey()
|
||||
}
|
||||
}
|
||||
|
||||
fn style_editor_highlight() -> ContentStyle {
|
||||
ContentStyle::default().black().on_cyan()
|
||||
}
|
||||
|
||||
fn style_pseudo_highlight() -> ContentStyle {
|
||||
ContentStyle::default().black().on_yellow()
|
||||
}
|
||||
|
||||
pub fn msg<M: Msg + ChatMsg>(highlighted: bool, indent: usize, msg: &M) -> BoxedWidget {
|
||||
let (nick, content) = msg.styled();
|
||||
HJoin::new(vec![
|
||||
Segment::new(
|
||||
Padding::new(time::widget(Some(msg.time()), highlighted))
|
||||
Padding::new(time::widget(Some(msg.time()), style_time(highlighted)))
|
||||
.stretch(true)
|
||||
.right(1),
|
||||
),
|
||||
Segment::new(Indent::new(indent, highlighted)),
|
||||
Segment::new(Indent::new(indent, style_indent(highlighted))),
|
||||
Segment::new(Layer::new(vec![
|
||||
Indent::new(1, false).into(),
|
||||
Indent::new(1, style_indent(false)).into(),
|
||||
Padding::new(Text::new(nick)).right(1).into(),
|
||||
])),
|
||||
// TODO Minimum content width
|
||||
|
|
@ -46,11 +70,11 @@ pub fn msg<M: Msg + ChatMsg>(highlighted: bool, indent: usize, msg: &M) -> Boxed
|
|||
pub fn msg_placeholder(highlighted: bool, indent: usize) -> BoxedWidget {
|
||||
HJoin::new(vec![
|
||||
Segment::new(
|
||||
Padding::new(time::widget(None, highlighted))
|
||||
Padding::new(time::widget(None, style_time(highlighted)))
|
||||
.stretch(true)
|
||||
.right(1),
|
||||
),
|
||||
Segment::new(Indent::new(indent, highlighted)),
|
||||
Segment::new(Indent::new(indent, style_indent(highlighted))),
|
||||
Segment::new(Text::new((PLACEHOLDER, style_placeholder()))),
|
||||
])
|
||||
.into()
|
||||
|
|
@ -68,13 +92,13 @@ pub fn editor<M: ChatMsg>(
|
|||
|
||||
let widget = HJoin::new(vec![
|
||||
Segment::new(
|
||||
Padding::new(time::widget(None, true))
|
||||
Padding::new(time::widget(None, style_editor_highlight()))
|
||||
.stretch(true)
|
||||
.right(1),
|
||||
),
|
||||
Segment::new(Indent::new(indent, true)),
|
||||
Segment::new(Indent::new(indent, style_editor_highlight())),
|
||||
Segment::new(Layer::new(vec![
|
||||
Indent::new(1, false).into(),
|
||||
Indent::new(1, style_indent(false)).into(),
|
||||
Padding::new(Text::new(nick)).right(1).into(),
|
||||
])),
|
||||
Segment::new(editor).priority(1).expanding(true),
|
||||
|
|
@ -89,13 +113,13 @@ pub fn pseudo<M: ChatMsg>(indent: usize, nick: &str, editor: &EditorState) -> Bo
|
|||
|
||||
HJoin::new(vec![
|
||||
Segment::new(
|
||||
Padding::new(time::widget(None, true))
|
||||
Padding::new(time::widget(None, style_pseudo_highlight()))
|
||||
.stretch(true)
|
||||
.right(1),
|
||||
),
|
||||
Segment::new(Indent::new(indent, true)),
|
||||
Segment::new(Indent::new(indent, style_pseudo_highlight())),
|
||||
Segment::new(Layer::new(vec![
|
||||
Indent::new(1, false).into(),
|
||||
Indent::new(1, style_indent(false)).into(),
|
||||
Padding::new(Text::new(nick)).right(1).into(),
|
||||
])),
|
||||
Segment::new(Text::new(content).wrap(true)).priority(1),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue