2

I can produce on terminal with zsh SHELL a list of 256 colors with the command :

for code in {000..255}
do
    print -P -- "$code: %F{$code}Color%f"
done

and currently, I am using dircolors with zsh :

NORMAL 01;37       # global default, although everything should be something.
FILE 01;37         # normal file
DIR 32       # directory
LINK 01;36      # symbolic link
FIFO 40;33      # pipe
SOCK 01;35      # socket
BLK 40;33;01    # block device driver
CHR 40;33;01    # character device driver

# This is for files with execute permission:
EXEC 00;36

# List any file extensions like '.gz' or '.tar' that you would like ls
# to colorize below. Put the extension, a space, and the color init string.
# (and any comments you want to add after a '#')
*~   05;31 # stuff we hate to find laying around (flashing red)
.mtxt 05;31 # crap
.ndx 05;31
.cmd 00;33 # executables
.exe 00;33
.com 00;33
.btm 00;33
.bat 00;33
.txt 00;37
.pdf 04;94
.docx 00;91
.doc 00;91
.xlsx 00;91
.xls 00;91
#.txt 07;40
.c   00;35 # source code
.h   00;35
.sh  00;36
.py  00;36
.cpp  00;35
.pl  00;36
.pm  00;35
.cgi 00;35
.java 00;35
.html 00;35
.tar 00;31 # archives or compressed (bright red)
.tgz 00;31
.arj 00;31
.taz 00;31
.lzh 00;31
.zip 00;31
.z   00;31
.Z   00;31
.gz  00;31
.jpg 01;35 # image formats
.jpeg 01;35
.JPG 01;35
.gif 01;35
.GIF 01;35
.bmp 01;35
.BMP 01;35
.xbm 01;35
.ppm 01;35
.xpm 01;35
.tif 01;35
.png 01;35

If this possible, how I could use in ~/.dircolors some colors came from the 256 values generated initially in my post ( loop with print -P -- "$code: %F{$code}Color%f" ) ?

Or are there others alternatives to have more colors with ~/.dircolors ?

1 Answers1

0

The numbers used in dircolors are ANSI SGR parameters. Read the linked article for more info. It also lists which numbers correspond to which colors from the 256-color palette.

Marlon Richert
  • 5,250
  • 1
  • 18
  • 27