summaryrefslogtreecommitdiffstats
path: root/src/config/clean/theme/config.rs
diff options
context:
space:
mode:
authorBen Webb <benjaminedwardwebb@gmail.com>2024-02-15 12:12:12 -0500
committerGitHub <noreply@github.com>2024-02-15 12:12:12 -0500
commit8d334cbe73ade11a0b48eea41971ab24644d43ab (patch)
treed3fdfc8e3397f5428ba2edbbce4049a7638b6582 /src/config/clean/theme/config.rs
parent4acace666d3d87bccf42e12e298bc0995c2e77e0 (diff)
feat lscolors support (#489)
* feat lscolors support Adds support for styling entries using the LS_COLORS environment variable. This styling is gated behind a configuration variable. If its enabled, any other styling for entries based on theme configuration is ignored. * feat lscolors apply cargo fmt and clippy edits
Diffstat (limited to 'src/config/clean/theme/config.rs')
-rw-r--r--src/config/clean/theme/config.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/config/clean/theme/config.rs b/src/config/clean/theme/config.rs
index 5be88fc..7fd25cd 100644
--- a/src/config/clean/theme/config.rs
+++ b/src/config/clean/theme/config.rs
@@ -1,3 +1,4 @@
+use lscolors::LsColors;
use std::collections::HashMap;
use crate::config::raw::theme::AppThemeRaw;
@@ -20,6 +21,7 @@ pub struct AppTheme {
pub link_invalid: AppStyle,
pub socket: AppStyle,
pub ext: HashMap<String, AppStyle>,
+ pub lscolors: Option<LsColors>,
}
impl AppTheme {
@@ -64,6 +66,13 @@ impl From<AppThemeRaw> for AppTheme {
(k.clone(), style)
})
.collect();
+ let lscolors = if raw.lscolors_enabled {
+ let lscolors = LsColors::from_env();
+ let default = Some(LsColors::default());
+ lscolors.or(default)
+ } else {
+ None
+ };
Self {
selection,
@@ -76,6 +85,7 @@ impl From<AppThemeRaw> for AppTheme {
socket,
ext,
tabs: TabTheme::from(tabs),
+ lscolors,
}
}
}