improve colors

This commit is contained in:
Michael Sippel 2022-10-15 03:52:38 +02:00
parent 21f7043ef0
commit 096e343f25
6 changed files with 24 additions and 21 deletions

View file

@ -4,7 +4,9 @@ use {
pub fn bg_style_from_depth(depth: usize) -> TerminalStyle {
match depth {
1 => TerminalStyle::bg_color((40,40,40)),
0 => TerminalStyle::bg_color((150,80,230)),
1 => TerminalStyle::bg_color((35,35,35)),
2 => TerminalStyle::bg_color((10,10,10)),
_ => TerminalStyle::default(),
}
}
@ -13,9 +15,9 @@ pub fn fg_style_from_depth(depth: usize) -> TerminalStyle {
match depth % 6 {
0 => TerminalStyle::fg_color((40, 180, 230)),
1 => TerminalStyle::fg_color((120, 120, 120)),
2 => TerminalStyle::fg_color((230, 180, 40)),
2 => TerminalStyle::fg_color((250, 165, 40)),
3 => TerminalStyle::fg_color((80, 180, 200)),
4 => TerminalStyle::fg_color((70, 90, 180)),
4 => TerminalStyle::fg_color((180, 240, 85)),
5 => TerminalStyle::fg_color((200, 190, 70)),
_ => TerminalStyle::default()
}

View file

@ -160,10 +160,13 @@ where ItemEditor: TerminalTreeEditor + ?Sized + Send + Sync + 'static
if direction.y < 0 {
// up
/*
self.cursor.set(ListCursor {
mode: cur.leaf_mode,
idx: None
});
});
*/
self.cursor.set(ListCursor::none());
TreeNavResult::Exit
} else if direction.y > 0 {
// dn
@ -232,6 +235,7 @@ where ItemEditor: TerminalTreeEditor + ?Sized + Send + Sync + 'static
mode: cur.leaf_mode,
idx: None
});
self.cursor.set(ListCursor::none());
TreeNavResult::Exit
}
}
@ -282,6 +286,7 @@ where ItemEditor: TerminalTreeEditor + ?Sized + Send + Sync + 'static
mode: cur.leaf_mode,
idx: None
});
self.cursor.set(ListCursor::none());
TreeNavResult::Exit
}
}

View file

@ -220,7 +220,6 @@ impl<ItemEditor> TerminalTreeEditor for PTYListEditor<ItemEditor>
where ItemEditor: TerminalTreeEditor + ?Sized + Send + Sync + 'static
{}
use crate::{
char_editor::CharEditor,
sequence::SequenceViewExt

View file

@ -48,15 +48,14 @@ where ItemEditor: TerminalTreeEditor + ?Sized + Send + Sync + 'static
let c = e.read().unwrap().get_cursor();
let cur_depth = c.tree_addr.len();
let select =
cur_dist == 0 &&
if c.leaf_mode == ListCursorMode::Select {
cur_depth == 0
if cur_dist == 0 {
cur_depth
} else {
cur_depth == 1
usize::MAX
};
atom
.add_style_back(bg_style_from_depth(if select { 1 } else { 0 }))
.add_style_back(TerminalStyle::bold(select))
.add_style_back(bg_style_from_depth(select))
.add_style_back(TerminalStyle::bold(select==1))
.add_style_back(fg_style_from_depth(d))
})
}

View file

@ -178,7 +178,7 @@ impl TreeNav for ProductEditor {
//\\//\\//\\//\\
match ce.goby(direction) {
TreeNavResult::Exit => {
*cur_depth = 1;
// *cur_depth = 1;
drop(ce);
drop(e);
@ -195,7 +195,6 @@ impl TreeNav for ProductEditor {
TreeNavResult::Continue
} else if direction.y == 0 {
// horizontal
if direction.x != 0 {
*cur_depth = 0;
}

View file

@ -49,16 +49,15 @@ impl ProductEditorSegment {
let c = e.read().unwrap().get_cursor();
let cur_depth = c.tree_addr.len();
let select =
cur_dist == 0 &&
if c.leaf_mode == ListCursorMode::Select {
cur_depth == 0
if cur_dist == 0 {
cur_depth
} else {
cur_depth == 1
usize::MAX
};
return x
.add_style_back(bg_style_from_depth(if select { 1 } else { 0 }))
.add_style_back(TerminalStyle::bold(select))
.add_style_back(bg_style_from_depth(select))
.add_style_back(TerminalStyle::bold(select==1))
.add_style_back(fg_style_from_depth(d));
}
}),
@ -71,8 +70,8 @@ impl ProductEditorSegment {
let cur_dist = *cur_dist;
move |i, x|
x.add_style_back(TerminalStyle::fg_color((130,90,40)))
.add_style_back(bg_style_from_depth(if cur_dist == 0 { 1 } else { 0 }))
x.add_style_back(TerminalStyle::fg_color((215,140,95)))
.add_style_back(bg_style_from_depth(if cur_dist == 0 { 0 } else { usize::MAX }))
.add_style_back(TerminalStyle::bold(cur_dist == 0))
})
}