Midnight Commander colors and themes

Midnight Commander theme howtoMidnight Commander is the most pupular file manager on unix like systems. It's fast and it has all features what you need. But it's only blue and we know, that everyone loves the eyecandy, everyone likes customizing his/her own desktop. But is there any way to custimize the mc?
Yes, and I try to show you, how can you create your theme.

You can change the Midnight Commander colors if you edit the ~/.mc/ini file, where you have to add a new section, named [Colors]. You should define the new colors in this section, for example:

[Colors]
base_color=lightgray,green:normal=green,default:selected=white,gray ...

As you see, it has a simple syntax:

<keyword>=<foregroundcolor>,<backgroundcolor>:<keyword>= ...

The colors are optional, so you can use this:

[Colors]
base_color=lightgray,green:normal=green:selected=,gray ...

It's not the exactly the same as the first version!

Fine, you can change some colors of the filemanager, but which are the keywords? These are:

  • Base colors: normal, selected, marked, markselect, errors, input, reverse, gauge
  • Menu colors: menu, menusel, menuhot, menuhotsel
  • Dialog colors: dnormal, dfocus, dhotnormal, dhotfocus
  • Help colors: helpnormal, helpitalic, helpbold, helplink, helpslink
  • Viewer color: viewunderline
  • Special highlighting colors: executable, directory, link, stalelink, device, special, core
  • Editor colors: editnormal, editbold, editmarked

And which are the colors? I don't know all, but here are some of them:
white, gray, blue, green, yellow, magenta, cyan, red, brown, birghtgreen, brightblue, brightmagenta, brightcyan, brightred, default

Here is the config, what I use:

[Colors]
base_color=lightgray,green:normal=green,default:selected=white,gray:marked=yellow,default:markselect=yellow,gray:directory=blue,default:executable=brightgreen,default:link=cyan,default:device=brightmagenta,default:special=lightgray,default:errors=red,default:reverse=green,default:gauge=green,default:input=white,gray:dnormal=green,gray:dfocus=brightgreen,gray:dhotnormal=cyan,gray:dhotfocus=brightcyan,gray:menu=green,default:menuhot=cyan,default:menusel=green,gray:menuhotsel=cyan,default:helpnormal=cyan,default:editnormal=green,default:editbold=blue,default:editmarked=gray,blue:stalelink=red,default
themed midnight commander

Screenshot about my redesigned Midnight Commander

On the screenshot you can see, that the directory color is blue, the files are green, the executable files are birghtgreen and the selected line is white on a gray background.

And another one, what I use recently:

[Colors]
base_color=lightgray,blue:normal=blue,default:selected=white,brightblue:marked=yellow,default:markselect=yellow,gray:directory=brightblue,default:executable=brightgreen,default:link=cyan,default:device=brightmagenta,default:special=lightgray,default:errors=red,default:reverse=green,default:gauge=green,default:input=white,gray:dnormal=green,gray:dfocus=brightgreen,gray:dhotnormal=cyan,gray:dhotfocus=brightcyan,gray:menu=green,default:menuhot=cyan,default:menusel=green,gray:menuhotsel=cyan,default:helpnormal=cyan,default:editnormal=green,default:editbold=blue,default:editmarked=gray,blue:stalelink=red,default
themed midnight commander

Screenshot about my redesigned Midnight Commander

And here is a small shell script, which will help for you to test your new theme:

#!/bin/sh
mc --colors normal=green,default:selected=brightmagenta,gray:marked=yellow,default:markselect=yellow,gray:directory=blue,default:executable=brightgreen,default:link=cyan,default:device=brightmagenta,default:special=lightgray,default:errors=red,default:reverse=green,default:gauge=green,default:input=white,gray:dnormal=green,gray:dfocus=brightgreen,gray:dhotnormal=cyan,gray:dhotfocus=brightcyan,gray:menu=green,default:menuhot=cyan,default:menusel=green,gray:menuhotsel=cyan,default:helpnormal=cyan,default:editnormal=green,default:editbold=blue,default:editmarked=gray,blue:stalelink=red,default

Save it as mccolortest.sh, make it executable with the chmod +x mccolortest.sh command, and run it with the ./mccolortest.sh command. If you want to change a color, just edit this file. When you done, copy the colors and paste it below the [Colors] section in the ~/.mc/ini. If it doesn't exists, make it yourself.

For more information of the mc redesigning check its manual page.

Hozzászólások

On the same subject:
http://www.zagura.ro/index.php/2008/01/09/midnight-commander-color-themes/

Anonymous 2008, January 9 - 16:15

Also, you should know that most modern terminal applications allow you to redefine the exact shade of those 16 colors.

Some of them (such as the Gnome or KDE terminals) may have a place under their preferences where you can redefine the colors.

Older terminals, such as aterm, use ~/.Xdefaults for this. You can edit that file and add lines like this: "aterm*color1: OrangeRed" (without the quotes). What I've done with that is tell aterm that the "color1" (which was red) should now be "OrangeRed". See /usr/share/X11/rgb.txt for valid color names. You can use *color0 through *color15. So when you'll say "red" in MC's ini file, and if you use aterm, it will get replaced by color1 in ~/.Xdefaults and changed to OrangeRed. (Sorry, I don't remember the mappings between the names used by MC and 0-15 in Xdefaults by heart.)

Anonymous 2008, April 30 - 08:39

Any chance to change the color of the files by extension?

Anonymous 2009, June 4 - 10:38

I didn't find anything about it. By the way, since the extension doesn't determinate the file type in UNIX like systems, it wouldn't make any sense to do it.

Don't be silly. Mp3 is just music, txt is text, doc is document. The only thing, which is not exactly determinable is the executables, but whatever, it has +x flag.

Anonymous 2010, March 27 - 15:48

Midnight Commander supports this starting from 4.7.0-pre3 version.

Anonymous 2010, January 1 - 02:27

hei ajnasz, your color theme so very nice, keep my eye on my pc longer than usual. Well, i don't have much time to do more explore with this tricks. I think your taste so cool. If you have any kind of theme, i should be try it. :-)

Regards,

Dedi

Anonymous 2009, July 20 - 21:23

I am using MC on my router ASUS WL-500GP and I am developing php scripts on it. but as I see MC in openwrt (kmaikaze 8.09) does not use syntax-highlighting and it is very unconfortable.
Do you know how could I turn it on? I have already downloaded php.syntax file and put it into /usr/share/syntax dir but it does not seem to work. is it possible that some support is not compiled into my version or the syntax file must be compiled to another format?
Br Zé.

Anonymous 2009, August 31 - 17:57

I found it. in ~/.mc/cedit/Syntax must be this:
file ..\*\\.(php|PHP)$ PHP\sFile
include php.syntax

and in the same dir php.syntax file must be placed. (copied out from a source distrib)

Anonymous 2009, August 31 - 18:28

Midnight Commander supports skins starting from 4.7.0-pre3 version. You can download a skin with black as a main color from here:
http://zool.in.ua/software/bluemoon/

Anonymous 2010, January 1 - 02:32

Now ~/.mc dir is ignored. Now is ~/.config/mc ;)

Anonymous 2013, February 8 - 12:51

Also, in 4.8.3 here, I copied the first example scheme line and my colors are different. I can't even set the background of the select bar to gray (or "grey"): it gets replaced with black. Also, the panel headings remain blue here, unlike the (first) screenshot, and I can see no corresponding tag in the line anyway.

Good intro, regardless. Someone should post a pointer to a more up-to-date one, though, as Google seems to find this old thread within the top few hits. Király! ;)

--lunakid

Anonymous 2013, March 7 - 13:00

The colors are depends on the color settings of your terminal. I don't have those settings anymore which was when I posted this article, but here is my current. If I'm right, it's similar to that. Put it into your .Xdefaults

*background: #000000
*foreground: #EEEEEC

! Default
! 0: black
*color0: #1C1C1C
*color8: #333333
! 1: red
*color1: #C14242
*color9: #EF2929
! 2: green
*color2: #6AA037
*color10: #9DCF70
! 3: yellow
*color3: #CFAB2F
*color11: #FCDA4F
! 4: blue
*color4: #2D578A
*color12: #729FCF
! 5: magenta
*color5: #A85EB4
*color13: #AD7FA8
! 6: cyan
*color6: #2F8D8F
*color14: #34E2E2
! 7: white
*color7: #D3D7CF
*color15: #EEEEEC

Thank you for theme. I tried your last theme and it is exactly what I was searching for.

Anonymous 2013, August 19 - 00:32