[mike@maginot]
This commit is contained in:
+12
-12
@@ -8,9 +8,9 @@ import (
|
||||
"github.com/fatih/color"
|
||||
)
|
||||
|
||||
// Dateityp → Farbe, nach den file_type-Rollen des eza-Themes
|
||||
// (~/src/mwxcol/themes/eza/theme.yml), damit dieselbe Datei in eza und dx
|
||||
// dieselbe Farbe hat.
|
||||
// File type → colour, after the file_type roles of the eza theme
|
||||
// (~/src/mwxcol/themes/eza/theme.yml), so that the same file has the same
|
||||
// colour in eza and in dx.
|
||||
var byExt = map[string]*color.Color{}
|
||||
|
||||
func register(c *color.Color, exts ...string) {
|
||||
@@ -20,7 +20,7 @@ func register(c *color.Color, exts ...string) {
|
||||
}
|
||||
|
||||
func init() {
|
||||
// source — blau
|
||||
// source — blue
|
||||
register(cBlue,
|
||||
"go", "c", "h", "cc", "cpp", "cxx", "hpp", "rs", "py", "pl", "pm", "t",
|
||||
"sh", "bash", "zsh", "fish", "js", "mjs", "cjs", "ts", "jsx", "tsx",
|
||||
@@ -33,7 +33,7 @@ func init() {
|
||||
register(cOrange,
|
||||
"zip", "tar", "gz", "tgz", "bz2", "tbz", "xz", "txz", "zst", "7z",
|
||||
"rar", "lz", "lzma", "z", "jar", "war", "dmg", "iso", "pkg", "deb", "rpm")
|
||||
// image — violett
|
||||
// image — violet
|
||||
register(cViolet,
|
||||
"jpg", "jpeg", "png", "gif", "bmp", "tif", "tiff", "svg", "webp",
|
||||
"heic", "heif", "ico", "psd", "ai", "eps", "raw", "cr2", "nef", "dng",
|
||||
@@ -41,26 +41,26 @@ func init() {
|
||||
// video — pink
|
||||
register(cPink,
|
||||
"mp4", "mov", "avi", "mkv", "webm", "m4v", "mpg", "mpeg", "wmv", "flv", "m2ts")
|
||||
// music / lossless — grün
|
||||
// music / lossless — green
|
||||
register(cGreen,
|
||||
"mp3", "aac", "m4a", "ogg", "opus", "wma", "flac", "wav", "aiff", "aif", "alac")
|
||||
// crypto — rot
|
||||
// crypto — red
|
||||
register(cRed,
|
||||
"asc", "gpg", "pgp", "sig", "key", "pem", "crt", "cer", "p12", "kdbx")
|
||||
// document — weiß
|
||||
// document — white
|
||||
register(cWhite,
|
||||
"pdf", "doc", "docx", "odt", "xls", "xlsx", "ods", "ppt", "pptx", "odp",
|
||||
"epub", "rtf", "txt", "csv", "pages", "numbers")
|
||||
// compiled — grau
|
||||
// compiled — grey
|
||||
register(cGrey,
|
||||
"o", "a", "so", "dylib", "obj", "lib", "class", "pyc", "pyo", "wasm", "d")
|
||||
// temp — dunkel
|
||||
// temp — dark
|
||||
register(cDarker,
|
||||
"tmp", "temp", "swp", "swo", "bak", "old", "orig", "rej", "lock",
|
||||
"part", "crdownload", "log")
|
||||
}
|
||||
|
||||
// build — gelb (README, Makefile, …)
|
||||
// build — yellow (README, Makefile, …)
|
||||
var byName = map[string]*color.Color{
|
||||
"makefile": cYellow, "gnumakefile": cYellow, "cmakelists.txt": cYellow,
|
||||
"dockerfile": cYellow, "justfile": cYellow, "rakefile": cYellow,
|
||||
@@ -71,7 +71,7 @@ var byName = map[string]*color.Color{
|
||||
}
|
||||
|
||||
func fileColor(name string, mode os.FileMode) *color.Color {
|
||||
if mode&0o111 != 0 { // ausführbar schlägt alles andere, wie in eza
|
||||
if mode&0o111 != 0 { // executable beats everything else, as in eza
|
||||
return cExecB
|
||||
}
|
||||
low := strings.ToLower(name)
|
||||
|
||||
Reference in New Issue
Block a user