Crate lscolors

source ·
Expand description

A library for colorizing paths according to the LS_COLORS environment variable.

§Example

use lscolors::{LsColors, Style};

let lscolors = LsColors::from_env().unwrap_or_default();

let path = "some/folder/archive.zip";
let style = lscolors.style_for_path(path);

// If you want to use `nu_ansi_term`:
let ansi_style = style.map(Style::to_nu_ansi_term_style).unwrap_or_default();
println!("{}", ansi_style.paint(path));

// If you want to use `ansi_term`:
let ansi_style = style.map(Style::to_ansi_term_style).unwrap_or_default();
println!("{}", ansi_style.paint(path));

Re-exports§

Modules§

  • A module for ANSI styles

Structs§

  • Holds information about how different file system entries should be colorized / styled.
  • Iterator over the path components with their respective style.

Enums§

Traits§