Skip to content
internal/config
Edit
On this page

The go:embed classification data: the text extension and text MIME type lists, the dark and light terminal color themes, and the loaders that parse them.

#internal/config

#internal/config

Package config provides the embedded text-classification lists and color themes. Everything is compiled into the binary via go:embed: there are no runtime config files and no lookup in cwd, HOME, or XDG directories. Changing the lists means a rebuild.

#Theme

Go go
type Theme struct

Theme holds the ANSI 256-color codes for one color theme. Each value is a 256-color palette index as a decimal string, or "" for no color.

#TextExtensions

Go go
func TextExtensions() map[string]struct{}

TextExtensions returns the set of lowercased, dot-stripped file extensions that classify a file as text.

#TextMimetypes

Go go
func TextMimetypes() map[string]struct{}

TextMimetypes returns the set of lowercased MIME types that classify a file as text even though they do not start with "text/".

#CanonicalFormats

Go go
func CanonicalFormats() map[string]string

CanonicalFormats returns the alias table applied to group names under --formats canonical: raw group name (a normalized extension or a sniffed MIME type) to the canonical format it is counted under.

#LoadTheme

Go go
func LoadTheme(name string) Theme

LoadTheme returns the embedded theme for name, which must be "dark" or "light".

Search