package lscolors

import ""

Package lscolors provides styling of filenames based on file features.

This is a reverse-engineered implementation of the parsing and interpretation of the LS_COLORS environmental variable used by GNU coreutils.


Package Files

feature.go lscolors.go stat_notsolaris.go stat_unix.go

func WithTestLsColors

func WithTestLsColors() func()

WithTestLsColors sets LS_COLORS to a value where directories are blue and .png files are red. It returns a function to restore the old value. This function is mainly useful in tests.

type Colorist

type Colorist interface {
    // GetStyle returns the style for the named file.
    GetStyle(fname string) string

Colorist styles filenames based on the features of the file.

func GetColorist

func GetColorist() Colorist

Package lscolors imports 7 packages (graph) and is imported by 2 packages. Updated 1 week ago.

Tools for package owners.