From 07e3c6d4b16d3856e327b01258db6515082858a6 Mon Sep 17 00:00:00 2001 From: Robert Minsk Date: Thu, 14 Sep 2023 18:30:19 -0700 Subject: [PATCH] docs: Document filetypes theme and rename trait --- src/theme/mod.rs | 42 +++++++++++++++++++++++------------------- src/theme/ui_styles.rs | 21 +++++++++++---------- 2 files changed, 34 insertions(+), 29 deletions(-) diff --git a/src/theme/mod.rs b/src/theme/mod.rs index 4b23a1f60..a878bf481 100644 --- a/src/theme/mod.rs +++ b/src/theme/mod.rs @@ -59,7 +59,7 @@ pub struct Definitions { pub struct Theme { pub ui: UiStyles, - pub exts: Box, + pub exts: Box, } impl Options { @@ -68,7 +68,7 @@ impl Options { pub fn to_theme(&self, isatty: bool) -> Theme { if self.use_colours == UseColours::Never || (self.use_colours == UseColours::Automatic && ! isatty) { let ui = UiStyles::plain(); - let exts = Box::new(NoFileColours); + let exts = Box::new(NoFileStyle); return Theme { ui, exts }; } @@ -78,7 +78,7 @@ impl Options { // Use between 0 and 2 file name highlighters let exts = match (exts.is_non_empty(), use_default_filetypes) { - (false, false) => Box::new(NoFileColours) as Box<_>, + (false, false) => Box::new(NoFileStyle) as Box<_>, (false, true) => Box::new(FileTypes) as Box<_>, ( true, false) => Box::new(exts) as Box<_>, ( true, true) => Box::new((exts, FileTypes)) as Box<_>, @@ -143,14 +143,18 @@ impl Definitions { } -pub trait FileColours: Sync { - fn colour_file(&self, file: &File<'_>, theme: &Theme) -> Option