pub struct Colorizer { /* private fields */ }Expand description
Color engine wrapping LS_COLORS / defaults.
Implementations§
Source§impl Colorizer
impl Colorizer
Sourcepub fn from_ls_colors(enabled: bool, ls_colors: &str) -> Self
pub fn from_ls_colors(enabled: bool, ls_colors: &str) -> Self
Build with an explicit LS_COLORS string (tests / overrides).
pub fn enabled(&self) -> bool
Sourcepub fn paint_name(&self, entry: &Entry, text: &str) -> String
pub fn paint_name(&self, entry: &Entry, text: &str) -> String
Colorize a display name for an entry using full LS_COLORS matching.
Hidden / dotfile names (leading .) are painted darker grey so they
recede next to normal entries (eza-style). Applies whenever colors are on,
including under --gnu when color is forced on.
Sourcepub fn style_for_entry<'a>(&'a self, entry: &'a Entry) -> Option<&'a Style>
pub fn style_for_entry<'a>(&'a self, entry: &'a Entry) -> Option<&'a Style>
Resolve LS_COLORS style for an entry (extension, type indicators, etc.).
pub fn paint_git_char(&self, ch: char) -> String
Sourcepub fn modern_long_theme(&self, gnu_mode: bool) -> bool
pub fn modern_long_theme(&self, gnu_mode: bool) -> bool
Whether modern multi-column long-format theming should run.
On for friendly (non-GNU) mode when colors are enabled; off under --gnu.
Sourcepub fn paint_perms(&self, perms: &str, gnu_mode: bool) -> String
pub fn paint_perms(&self, perms: &str, gnu_mode: bool) -> String
Permission string (e.g. -rwxr-xr-x) with type letter + rwx tinting.
Sourcepub fn paint_meta(&self, text: &str, gnu_mode: bool) -> String
pub fn paint_meta(&self, text: &str, gnu_mode: bool) -> String
Dim metadata (nlink, inode, blocks, context).
Sourcepub fn paint_user(&self, text: &str, gnu_mode: bool) -> String
pub fn paint_user(&self, text: &str, gnu_mode: bool) -> String
Owner / group / author column.
Sourcepub fn paint_size(&self, text: &str, bytes: u64, gnu_mode: bool) -> String
pub fn paint_size(&self, text: &str, bytes: u64, gnu_mode: bool) -> String
Size column: green → yellow → red by magnitude (bytes).
Sourcepub fn paint_time(&self, text: &str, gnu_mode: bool) -> String
pub fn paint_time(&self, text: &str, gnu_mode: bool) -> String
Timestamp column.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Colorizer
impl RefUnwindSafe for Colorizer
impl Send for Colorizer
impl Sync for Colorizer
impl Unpin for Colorizer
impl UnsafeUnpin for Colorizer
impl UnwindSafe for Colorizer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more