lscolors

Build Status

A library for colorizing paths according to the LS_COLORS environment variable (like ls).

Usage

```rust use lscolors::{LsColors, Style};

let lscolors = LsColors::fromenv().unwrapor_default();

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

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

Command-line application

This crate also comes with a small command-line program lscolors that can be used to colorize the output of other commands: ```bash

find . -maxdepth 2 | lscolors

rg foo -l | lscolors ```

License

Licensed under either of

at your option.