feat: ls_colors using palette

This commit is contained in:
2026-03-23 03:27:13 -04:00
parent 6bc4e3e870
commit aac9378d71
2 changed files with 24 additions and 23 deletions

View File

@@ -47,11 +47,11 @@ def build_ls_colors(colors: dict[str, str]) -> str:
entries = { entries = {
"no": "0", "no": "0",
"fi": "0", "fi": "0",
"di": sgr_fg(colors["func"], bold=True), "di": sgr_fg(colors["keyword"], bold=True),
"ln": sgr_fg(colors["field"], bold=True), "ln": sgr_fg(colors["field"], bold=True),
"or": sgr_fg(colors["error"], bold=True), "or": sgr_fg(colors["error"]),
"mi": "0", "mi": "0",
"so": sgr_fg(colors["type"]), "so": sgr_fg(colors["field"]),
"pi": sgr_fg(colors["string"]), "pi": sgr_fg(colors["string"]),
"do": sgr_fg(colors["func"], bold=True), "do": sgr_fg(colors["func"], bold=True),
"bd": sgr_fg(colors["number"]), "bd": sgr_fg(colors["number"]),
@@ -68,21 +68,21 @@ def build_ls_colors(colors: dict[str, str]) -> str:
"*.7z": sgr_fg(colors["string"]), "*.7z": sgr_fg(colors["string"]),
"*.zst": sgr_fg(colors["string"]), "*.zst": sgr_fg(colors["string"]),
"*.rar": sgr_fg(colors["string"]), "*.rar": sgr_fg(colors["string"]),
"*.jpg": sgr_fg(colors["field"]), "*.jpg": sgr_fg(colors["type"]),
"*.jpeg": sgr_fg(colors["field"]), "*.jpeg": sgr_fg(colors["type"]),
"*.png": sgr_fg(colors["field"]), "*.png": sgr_fg(colors["type"]),
"*.gif": sgr_fg(colors["field"]), "*.gif": sgr_fg(colors["type"]),
"*.svg": sgr_fg(colors["field"]), "*.svg": sgr_fg(colors["type"]),
"*.webp": sgr_fg(colors["field"]), "*.webp": sgr_fg(colors["type"]),
"*.mp3": sgr_fg(colors["type"]), "*.mp3": sgr_fg(colors["type"]),
"*.flac": sgr_fg(colors["type"]), "*.flac": sgr_fg(colors["type"]),
"*.wav": sgr_fg(colors["type"]), "*.wav": sgr_fg(colors["type"]),
"*.mp4": sgr_fg(colors["type"]), "*.mp4": sgr_fg(colors["type"]),
"*.mkv": sgr_fg(colors["type"]), "*.mkv": sgr_fg(colors["type"]),
"*.mov": sgr_fg(colors["type"]), "*.mov": sgr_fg(colors["type"]),
"*.pdf": sgr_fg(colors["number"]), "*.pdf": sgr_fg(colors["comment"]),
"*.md": sgr_fg(colors["comment"]), "*.md": sgr_fg(colors["comment"]),
"*.txt": sgr_fg(colors["fg"]), "*.txt": sgr_fg(colors["comment"]),
"*.log": sgr_fg(colors["comment"]), "*.log": sgr_fg(colors["comment"]),
"*.conf": sgr_fg(colors["keyword"]), "*.conf": sgr_fg(colors["keyword"]),
"*.json": sgr_fg(colors["keyword"]), "*.json": sgr_fg(colors["keyword"]),
@@ -90,21 +90,22 @@ def build_ls_colors(colors: dict[str, str]) -> str:
"*.yml": sgr_fg(colors["keyword"]), "*.yml": sgr_fg(colors["keyword"]),
"*.toml": sgr_fg(colors["keyword"]), "*.toml": sgr_fg(colors["keyword"]),
"*.ini": sgr_fg(colors["keyword"]), "*.ini": sgr_fg(colors["keyword"]),
"*.sh": sgr_fg(colors["func"], bold=True), "*.sh": sgr_fg(colors["func"]),
"*.bash": sgr_fg(colors["func"], bold=True), "*.bash": sgr_fg(colors["func"]),
"*.zsh": sgr_fg(colors["func"], bold=True), "*.zsh": sgr_fg(colors["func"]),
"*.py": sgr_fg(colors["func"]), "*.py": sgr_fg(colors["field"]),
"*.js": sgr_fg(colors["keyword"]), "*.js": sgr_fg(colors["field"]),
"*.ts": sgr_fg(colors["keyword"]), "*.ts": sgr_fg(colors["field"]),
"*.tsx": sgr_fg(colors["keyword"]), "*.tsx": sgr_fg(colors["field"]),
"*.jsx": sgr_fg(colors["keyword"]), "*.jsx": sgr_fg(colors["field"]),
"*.lua": sgr_fg(colors["type_alt"]), "*.lua": sgr_fg(colors["field"]),
"*.rs": sgr_fg(colors["type_alt"]), "*.rs": sgr_fg(colors["field"]),
"*.go": sgr_fg(colors["type_alt"]), "*.go": sgr_fg(colors["field"]),
"*.c": sgr_fg(colors["field"]), "*.c": sgr_fg(colors["field"]),
"*.h": sgr_fg(colors["field"]), "*.h": sgr_fg(colors["field"]),
"*.cpp": sgr_fg(colors["field"]), "*.cpp": sgr_fg(colors["field"]),
"*.hpp": sgr_fg(colors["field"]), "*.hpp": sgr_fg(colors["field"]),
"*.cs": sgr_fg(colors["field"]),
} }
return ":".join(f"{key}={value}" for key, value in entries.items()) return ":".join(f"{key}={value}" for key, value in entries.items())

View File

@@ -20,4 +20,4 @@ export RIDER_ESCAPE="#D688D4"
export RIDER_ERROR="#FF5647" export RIDER_ERROR="#FF5647"
# Shared Rider palette for GNU ls and compatible tools. # Shared Rider palette for GNU ls and compatible tools.
export LS_COLORS="no=0:fi=0:di=1;38;2;57;204;155:ln=1;38;2;102;195;204:or=1;38;2;255;86;71:mi=0:so=38;2;193;145;255:pi=38;2;201;162;109:do=1;38;2;57;204;155:bd=38;2;237;148;192:cd=38;2;237;148;192:su=1;38;2;255;86;71:sg=1;38;2;214;136;212:ex=1;38;2;57;204;155:*.tar=38;2;201;162;109:*.tgz=38;2;201;162;109:*.gz=38;2;201;162;109:*.bz2=38;2;201;162;109:*.xz=38;2;201;162;109:*.zip=38;2;201;162;109:*.7z=38;2;201;162;109:*.zst=38;2;201;162;109:*.rar=38;2;201;162;109:*.jpg=38;2;102;195;204:*.jpeg=38;2;102;195;204:*.png=38;2;102;195;204:*.gif=38;2;102;195;204:*.svg=38;2;102;195;204:*.webp=38;2;102;195;204:*.mp3=38;2;193;145;255:*.flac=38;2;193;145;255:*.wav=38;2;193;145;255:*.mp4=38;2;193;145;255:*.mkv=38;2;193;145;255:*.mov=38;2;193;145;255:*.pdf=38;2;237;148;192:*.md=38;2;133;196;108:*.txt=38;2;189;189;189:*.log=38;2;133;196;108:*.conf=38;2;108;149;235:*.json=38;2;108;149;235:*.yaml=38;2;108;149;235:*.yml=38;2;108;149;235:*.toml=38;2;108;149;235:*.ini=38;2;108;149;235:*.sh=1;38;2;57;204;155:*.bash=1;38;2;57;204;155:*.zsh=1;38;2;57;204;155:*.py=38;2;57;204;155:*.js=38;2;108;149;235:*.ts=38;2;108;149;235:*.tsx=38;2;108;149;235:*.jsx=38;2;108;149;235:*.lua=38;2;225;191;255:*.rs=38;2;225;191;255:*.go=38;2;225;191;255:*.c=38;2;102;195;204:*.h=38;2;102;195;204:*.cpp=38;2;102;195;204:*.hpp=38;2;102;195;204" export LS_COLORS="no=0:fi=0:di=1;38;2;108;149;235:ln=1;38;2;102;195;204:or=38;2;255;86;71:mi=0:so=38;2;102;195;204:pi=38;2;201;162;109:do=1;38;2;57;204;155:bd=38;2;237;148;192:cd=38;2;237;148;192:su=1;38;2;255;86;71:sg=1;38;2;214;136;212:ex=1;38;2;57;204;155:*.tar=38;2;201;162;109:*.tgz=38;2;201;162;109:*.gz=38;2;201;162;109:*.bz2=38;2;201;162;109:*.xz=38;2;201;162;109:*.zip=38;2;201;162;109:*.7z=38;2;201;162;109:*.zst=38;2;201;162;109:*.rar=38;2;201;162;109:*.jpg=38;2;193;145;255:*.jpeg=38;2;193;145;255:*.png=38;2;193;145;255:*.gif=38;2;193;145;255:*.svg=38;2;193;145;255:*.webp=38;2;193;145;255:*.mp3=38;2;193;145;255:*.flac=38;2;193;145;255:*.wav=38;2;193;145;255:*.mp4=38;2;193;145;255:*.mkv=38;2;193;145;255:*.mov=38;2;193;145;255:*.pdf=38;2;133;196;108:*.md=38;2;133;196;108:*.txt=38;2;133;196;108:*.log=38;2;133;196;108:*.conf=38;2;108;149;235:*.json=38;2;108;149;235:*.yaml=38;2;108;149;235:*.yml=38;2;108;149;235:*.toml=38;2;108;149;235:*.ini=38;2;108;149;235:*.sh=38;2;57;204;155:*.bash=38;2;57;204;155:*.zsh=38;2;57;204;155:*.py=38;2;102;195;204:*.js=38;2;102;195;204:*.ts=38;2;102;195;204:*.tsx=38;2;102;195;204:*.jsx=38;2;102;195;204:*.lua=38;2;102;195;204:*.rs=38;2;102;195;204:*.go=38;2;102;195;204:*.c=38;2;102;195;204:*.h=38;2;102;195;204:*.cpp=38;2;102;195;204:*.hpp=38;2;102;195;204:*.cs=38;2;102;195;204"