Ajnasz Blog

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

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

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 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.

  • Del.icio.us
  • Reddit icon

Trackback URL for this post:

http://ajnasz.hu/trackback/163

On the same

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

Change color shades

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.)

Change file colors?

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

I didn't find anything about

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

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.

Of course

Midnight Commander supports this starting from 4.7.0-pre3 version.

cool taste

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

off a bit

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é.

re:off a bit

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)

MC supports skins now

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/

Hozzászólás

  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • A sorokat és bekezdéseket automatikusan felismeri a rendszer.

További információ a formázási lehetőségekről

CAPTCHA
A kérdés azt vizsgálja, hogy valós látogató, vagy robot szeretné az űrlapot beküldeni. This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Kép CAPTCHA
Enter the characters shown in the image.