summaryrefslogtreecommitdiffstats
path: root/src/fs
diff options
context:
space:
mode:
authorJiayi Zhao <jeff.no.zhao@gmail.com>2020-02-16 11:59:33 -0500
committerJiayi Zhao <jeff.no.zhao@gmail.com>2020-02-16 12:01:23 -0500
commitd788f8d740be85bb014ddfa005156723f0a31e99 (patch)
tree1cd74c86358b70f78dffe25da5e0bfe4bd9b1abf /src/fs
parent726a7a424f7ddec97478490a0f3a25005dde45ac (diff)
rework rendering system to use tui-rs widgets
- move files around - delete some old ncurses code - integrate tui-rs styles and colors
Diffstat (limited to 'src/fs')
-rw-r--r--src/fs/entry.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/fs/entry.rs b/src/fs/entry.rs
index 4cf3ead..36788cf 100644
--- a/src/fs/entry.rs
+++ b/src/fs/entry.rs
@@ -1,5 +1,8 @@
use std::{fs, path};
+use tui::style::{Color, Style};
+use tui::widgets::Text;
+
use crate::fs::JoshutoMetadata;
#[derive(Clone, Debug)]
@@ -60,6 +63,23 @@ impl JoshutoDirEntry {
pub fn set_selected(&mut self, selected: bool) {
self.selected = selected;
}
+
+ pub fn get_fg_color(&self) -> Color {
+ let metadata = &self.metadata;
+ let filetype = metadata.file_type;
+
+ if filetype.is_dir() {
+ Color::LightBlue
+ } else if filetype.is_symlink() {
+ Color::Cyan
+ } else {
+ Color::White
+ }
+ }
+
+ pub fn get_bg_color(&self) -> Color {
+ Color::Reset
+ }
}
impl std::fmt::Display for JoshutoDirEntry {