Midnight Commander Color Themes
Here is a script to easy change the default blue scheme of Midnight Commander.
Unpack the archive and do:
./mc_change_theme.sh puthre.theme
To revert to the default scheme just:
./mc_change_theme.sh default.theme
The script will modify your ~/.mc/ini file. Please make sure that Midnight Commander is not running when you change your theme.
Here is how a theme file looks:
BASE_COLOR=lightgray,blue
NORMAL=lightgray,blue
SELECTED=black,cyan
MARKED=yellow,blue
MARKSELECT=yellow,cyan
ERRORS=white,red
MENU=white,cyan
REVERSE=black,lightgray
DNORMAL=black,lightgray
DFOCUS=black,cyan
DHOTNORMAL=blue,lightgray
DHOTFOCUS=blue,cyan
VIEWUNDERLINE=brightred,blue
MENUHOT=yellow,cyan
MENUSEL=white,black
MENUHOTSEL=yellow,black
HELPNORMAL=black,lightgray
HELPITALIC=red,lightgray
HELPBOLD=blue,lightgray
HELPLINK=black,cyan
HELPSLINK=yellow,blue
GAUGE=white,black
INPUT=black,cyan
DIRECTORY=white,blue
EXECUTABLE=brightgreen,blue
LINK=lightgray,blue
STALELINK=brightred,blue
DEVICE=brightmagenta,blue
CORE=red,blue
SPECIAL=black,blue
EDITNORMAL=lightgray,blue
EDITBOLD=yellow,blue
EDITMARKED=black,cyan
ERRDHOTNORMAL=yellow,red
ERRDHOTFOCUS=yellow,lightgray


[…] merge mai departe la: dani, beni (prolly direct in spam box), hash (mai scrie bai si tu cate ceva), puthre, popescu, si inca unul la […]
Pingback by Nenea Lars » Leapsa cu pagina 123 — February 4, 2008 @ 4:32 pm
wow, very nice.
thank you
Comment by Arman — February 12, 2008 @ 9:56 am
Thanks… the default colors were killing me… I can work again.
Comment by Jerry McBride — March 4, 2008 @ 10:45 pm
[…] Midnight Commander Color Themes […]
Pingback by How to install Midnight Commander under Mac OS X (the easy way, using Rudix) « Michigan Telephone, VoIP and Broadband blog — April 1, 2008 @ 11:36 pm
Very beautiful. Thank you
Comment by alpha — April 2, 2008 @ 4:10 am
This is a neat script.
May I suggest a slight improvement (for those of us stuck in non-Linux land)? When you test that mc is not running, just use ps and grep, rather than pidof (which is a Linux-only utility I think). Since we don’t actually care what the pid is, only that it’s running, you could rely on grep’s exit code and do this instead:
if ( ps | grep mc > /dev/null ) then
That should work on any system with bash, ps and grep installed, which I think covers off Cygwin, Mac OS X, *BSD and Solaris.
I’m going to be a happy MC themer with your script!
Cheers,
m
Comment by Michael Lockhart — April 10, 2008 @ 3:08 am
Thanks for the suggestion. I modified the script as you suggested.
Comment by puthre — April 23, 2008 @ 9:41 pm
Same here, the default theme was killed by my terminal color settings. Now I can use it properly again
Thanks alot!
Comment by kchr — June 8, 2008 @ 1:36 am
Your script has been discovered in Belgium, and used !!!
It rocks !
Comment by Ivan — June 15, 2008 @ 8:20 pm
A better ps/grep would be this:
if ( ps aux | grep mc | grep -v mc_change_theme >> /dev/null ) then
Which will exclude the ‘mc_change_theme’ from the list.
Then you can add an exit 1 there and stop the script from executing the theme change
Comment by lpotter — June 20, 2008 @ 9:56 pm
Hello thank you for the script very nice. I would love to see more of these themes anyone out there got any they want to share?
Comment by easoukenka — June 28, 2008 @ 12:05 pm
Nice script!
PS: comment #1 was written by an inconsiderate Romanian guy who didn’t bother to write English.
Comment by Dan Dascalescu — July 11, 2008 @ 12:02 am
Good effort.
It has a few little issues when being used on FreeBSD, I had to change the path to the bash binary, would be good if it could work under standard old /bin/sh
It would be easier if the program just warned not to have mc running, I still had a bunch of processes that had the letters ‘mc’ in my background so I had to hash out this check code.
Also I think by far the best mc colors are the ones that are default in the modded version of mc which is mc-light, only problem with mc-light is that it has heaps of bugs. If we could get mc-lights colors on standard mc I would be in heaven.
Comment by Thebeastie — August 18, 2008 @ 5:15 am
Very cool script, thank you!
Comment by Chris — August 21, 2008 @ 4:48 am
Used or proposed check for running “mc” isn’t working, cause:
1. this expression “if ( ps | grep mc > /dev/null ) doesn’t work at all
2. this expression “if ( ps aux | grep mc | grep -v mc_change_theme >> /dev/null ) then” work, but they catch anything like “mc” “xxxmcxxx” and of course grep process itself.
here is my version of check for running mc in right way:
if ( ps axu | grep -w [m]c > /dev/null ) then
Comment by Nifty — August 24, 2008 @ 9:55 pm
Changed the way I check for mc running as Nifty suggests (thanks Nifty).
I also changed /bin/bash to /bin/sh as Thebeastie suggests (thanks Thebeastie)
Comment by puthre — August 25, 2008 @ 4:21 pm
hi, thank you for this script!
there is a little inconsistency with the manfiles. base_color is no color-keyword. I think the color names in “base_color=lightgray,blue” are ignored. You could write
xterm=normal=white,black:marked=red,black
rxvt=normal=yellow,black:marked=red,black
in this case, mc would show normal text in a xterm in white and in a rxvt terminal in yellow.
If you use base_color instead of xterm or rxvt, it is used for all terminals. I think the color names in “base_color=lightgray,blue” are ignored. I think cool would be a syntax for the theme file like:
[base_color]
NORMAL=white,black
MARKED=red,black
[xterm]
NORMAL=yellow,black
this would generate
base_color=normal=white,black:marked=red,black
xterm=normal=yellow,black
by the way, where did you find the Keywords ERRDHOTNORMAL and ERRDHOTFOCUS?
Comment by niun — October 20, 2008 @ 7:30 pm
I think I found all the keywords in Midnight Commander source code.
Comment by puthre — October 21, 2008 @ 9:29 am
Great! With your script I figured out for the first time
how to set MC’s colors.
One remark though: You are using the source command
which is available in bash but in other shells
maybe not.
For me it failed first and then worked after I changed
the first line into:
#!/bin/bash
Comment by Volker Paul — November 27, 2008 @ 1:47 am
I’ve changed back to #!/bin/bash
Thanks Paul.
Comment by puthre — December 17, 2008 @ 12:41 pm
Hello. This is great, thx 4 taking the time to do this. And fore the rest of us, especially lazy ones, pls find anonther theme based on this, with colors a bit warmer. The important lines go above:
BASE_COLOR=gray,black
NORMAL=white,black
MENU=yellow,gray
VIEWUNDERLINE=black,green
EDITNORMAL=white,black
EDITMARKED=black,white
MENUHOT=red,gray
DIRECTORY=yellow,gray
EXECUTABLE=brightgreen,gray
DEVICE=magenta,gray
INPUT=yellow,gray
LINK=brightcyan,gray
STALLEDLINK=white,gray
REVERSE=brightmagenta,black
SELECTED=black,brown
MARKED=black,lightgray
MARKSELECT=black,yellow
Cheers
Comment by Bobby — December 17, 2008 @ 12:53 pm
Thank you Bobby. I’ve added your theme to the archive (bobby.theme).
Comment by puthre — December 18, 2008 @ 9:10 pm
THX! Great help to create rottex.theme for making mc adequate for night-shifts and still have some original mc-feel
See you in heaven !
BASE_COLOR=lightgray,black
NORMAL=lightgray,black
SELECTED=black,cyan
MARKED=yellow,black
MARKSELECT=yellow,cyan
ERRORS=white,red
MENU=white,cyan
REVERSE=black,lightgray
DNORMAL=black,lightgray
DFOCUS=black,cyan
DHOTNORMAL=yellow,lightgray
DHOTFOCUS=yellow,cyan
VIEWUNDERLINE=brightred,blue
MENUHOT=yellow,cyan
MENUSEL=lightgrey,black
MENUHOTSEL=yellow,black
HELPNORMAL=black,lightgray
HELPITALIC=red,lightgray
HELPBOLD=yellow,lightgray
HELPLINK=black,cyan
HELPSLINK=yellow,black
GAUGE=white,black
INPUT=black,cyan
DIRECTORY=white,black
EXECUTABLE=brightgreen,black
LINK=lightgray,black
STALELINK=brightred,black
DEVICE=brightmagenta,black
CORE=red,black
SPECIAL=black,blue
EDITNORMAL=lightgray,black
EDITBOLD=yellow,black
EDITMARKED=black,cyan
ERRDHOTNORMAL=yellow,red
ERRDHOTFOCUS=yellow,lightgray
Comment by rottex — February 18, 2009 @ 1:12 pm
Thanks Rottex, I’ve added your theme to the archive.
Comment by puthre — February 18, 2009 @ 1:57 pm
Very cool script, there is some news about mc : http://translate.google.com/translate?client=tmpg&hl=fr&u=http%3A%2F%2Fmc.redhat-club.org%2Fcms%2Fnews.php&langpair=ru|en
Comment by Soda — February 27, 2009 @ 1:06 pm
Your script is really cool
Thank you for your work… but if i can suggest something: it could be nice if the script also removes the ini from the temporary dir.
Comment by manio — March 19, 2009 @ 10:15 am
I’ve just added korg.theme to the archive, thanks to Manio (Mariusz BiaÅ‚oÅ„czyk) and Korg (Dmitry Korzhevin).
Comment by puthre — March 20, 2009 @ 7:57 pm
You just saved me a lot of work. For some reason using green on black in Kubuntu’s Konsole made the colors hard to read in MC. Your script worked like a charm. Thank you!
Comment by Glenn — March 22, 2009 @ 8:36 am
From argentina, your script help me a lot, tnx !!
Comment by charlie brown — May 30, 2009 @ 2:09 am
If blue-filled markers for tabs and spaces make you go crazy when you’re using the editor you should probably try something like ‘editwhitespace=gray,black’.
Comment by Ole G. — June 29, 2009 @ 7:20 pm
And while we’re at it… if the cursor disappears (turning black, really) right after deleting a marked block it is most likely because the background color is the same as the ‘editmarked’ foreground color. Try something like ‘editmarked=white,blue’.
Comment by Ole G. — June 29, 2009 @ 8:19 pm
Some of us might experience the cursor disappearing in the editor white space areas (like tabs and trailing line spaces). This is not a mc problem. I use mrxvt and the following line (taken from the mrxvtrc.sample) in ~/.mrxvtrc solved the problem:
Mrxvt.cursorColor: #00ff00
Mrxvt.cursorColor2: #000000
Comment by Ole G. — July 3, 2009 @ 2:16 pm
A more general problem is that the color defaults for X11 terminal emulators might be a little odd. See:
http://www.midnight-commander.org/ticket/385
Some values to put in ~/.Xdefaults is suggested:
*VT100*color0: #000000
*VT100*color1: #AA0000
*VT100*color2: #00AA00
*VT100*color3: #AA6600
*VT100*color4: #000080
*VT100*color5: #AA00AA
*VT100*color6: #00AAAA
*VT100*color7: #AAAAAA
*VT100*color8: #555555
*VT100*color9: #FF0000
*VT100*color10: #00FF00
*VT100*color11: #FFFF00
*VT100*color12: #0000FF
*VT100*color13: #FF00FF
*VT100*color14: #00FFFF
*VT100*color15: #FFFFFF
*VT100*colorULMode: on
*VT100*colorUL: #60AAAA
*VT100*colorBD: #FFFFFF
Log off and back to activate. All of a sudden the default blue might be a little less annoying…
Comment by Ole G. — July 3, 2009 @ 2:23 pm
hi,
i was really emphasized finding some code to colourchange the mc on different consoles, but i’m suffering an error while executing the script: “./mc_change_theme.sh: 72: source: not found”
shell executing “source rottex.theme” runs, with no output
OS ubuntu 8.04.3
scriptfolder /home/user/Desktop/mcthemes
has anybody an idea?
thanks & regards
jens
Comment by jens — August 9, 2009 @ 3:20 pm
Jens: You might try to replace #!/bin/sh
with #!/bin/bash on the top of the script.
Comment by puthre — August 12, 2009 @ 9:52 am
Really nice sript! Default MC is boring and ugly, but the “official way” to change this is really masochistic.
Comment by Radek — October 24, 2009 @ 12:35 pm
You may add the option
editwhitespace=gray,black
the default value is
editwhitespace=brightblue,blue
that really hurts your eyes when you are coding late.
Comment by gnusci — November 29, 2009 @ 7:28 pm
[…] are a few sample themes on a blog here, along with a script that will neatly insert them into your .mc/ini file for you, to expedite the […]
Pingback by Theming Midnight Commander « Motho ke motho ka botho — January 1, 2010 @ 6:01 am
Hi, when i diffed the ini file generated by your script with the original one i noticed some differences other than colors. It seemed that there where backslashes missing. It’s probably because “read” command treats “\” in a special manner. Using “read -r” solves the problem, but i’ve no idea if it can have some negative effect (for me it was OK).
Comment by fembe — January 2, 2010 @ 4:56 pm
Added a transparent mc tutorial over at ubuntuforums.org…
http://ubuntuforums.org/showthread.php?t=1403033
It links here to get your great little script
Screenshot is here…
http://bentfx.elementfx.com/images/mc_screenshot.png
Comment by BentFX — February 10, 2010 @ 3:20 am
Awesome job!
One thing to note though:
if ( ps axu | grep -w [m]c > /dev/null ) then
also ‘detects’ mc running for other users. Possible solution:
if ( ps axu | grep -w [m]c | grep `whoami` > dev/null ) then
Comment by MariusG — February 16, 2010 @ 6:05 pm