Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

change emacs bash colors for ls command

Tags:

bash

emacs

colors

I have enabled dircolors to change the ls command to have yellow for folders when using ls. The problem is that when I use the shell in emacs, it still shows them as navy blue which is hard to read on a black background.

How can I change the colors for the bash shell, or more particularly, the ls command. My color changes work on a opened terminal, but not for emacs. I have emacs23 with X support.

like image 696
Laren Mortensen Avatar asked Feb 22 '11 02:02

Laren Mortensen


People also ask

What do colors mean in ls?

Green: Executable or recognized data file. Cyan (Sky Blue): Symbolic link file. Yellow with black background: Device. Magenta (Pink): Graphic image file. Red: Archive file.

Where is LS_COLORS defined?

1) Configuration file for the ls color command is /etc/DIR_COLORS for Linux. You can modify those colours if you want. 4) You can customized them in /etc/DIR_COLORS or file pointed by shell variable COLORS.


1 Answers

If you are using ansi-color, it take the colors from the ansi-color-names-vector, the default is:

  ["black" "red" "green" "yellow" "blue" "magenta" "cyan" "white"]

You can customize the colors of the shell output altering the ansi-color-names-vector variable.

Here is mine, work well with zenburn theme.

(setq ansi-color-names-vector
      ["black" "tomato" "PaleGreen2" "gold1"
       "DeepSkyBlue1" "MediumOrchid1" "cyan" "white"])

To see the changes, evaluate the next expresion, and the next out take it in consideration

(setq ansi-color-map (ansi-color-make-color-map))

I hope this helps.

like image 72
Roberto Huelga Avatar answered Sep 28 '22 17:09

Roberto Huelga