I use Emacs 24 and want to change a color of dirs and files while I'm in shell-mode (ls
command). Ideally – depending on rights of the file.
How can i do this?
I tried playing with
(setq ansi-color-names-vector
["black" "red" "green" "yellow" "PaleBlue" "magenta" "cyan" "white"])
(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)
But I think it doesn't work for me.
I have solarized color scheme now. But I do not want to change it's colors, only for shell-mode.
Edit:
When I change colors for my system terminal (using .dircolrs file in my home directory) – emacs reads it, BUT it(emacs) slightly changes colors – it makes a color a bit darker or lighter in shell-mode.
And I don't know why Emacs does it.
Different dirs colors (games, Public…:
This is system terminal:
And this is Emacs:
These are changed colors, with default colors and solarized-theme Emacs made blue dirs on a blue background.
I understand that it's not a big problem to find a hack, just want to know why Emacs changes colors a bit.
Best Answer
M-x customize-variable RET ansi-color-names-vector RET
Existing text will not have been affected, but newly printed text (even in the same shell buffer) will show the new colors.