LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Midnight Commander Help (https://www.linuxquestions.org/questions/linux-general-1/midnight-commander-help-4175528982/)

CrazyCatLover 12-22-2014 02:40 AM

Midnight Commander Help
 
Hi,

I need to know how to check the current colour for mc and how to change it.
I google it and they talk about changeing some initial file /.mc/ini which i have no idea (no one ever gives full filename.)and i cant find it at all. Wasted an hour of my life. I just need the simplest way to change it, not another 10+ steps to change a stupid colour.

gengisdave 12-22-2014 03:22 AM

in some distros (mine, e.g.) it is located in ~/.local/mc/ini

sycamorex 12-22-2014 03:24 AM

This is the full filename. Mind you on my distro it's in ~/.config/mc/ini
Find / Create this file and add the following (obviously change the colour values):

The syntax is: variable=foreground_colour,background_colour
Code:

[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


Also, have a look at this:
http://blog.mybox.ro/2010/05/10/skin...ght-commander/

onebuck 12-22-2014 09:34 AM

Member response
 
Hi,

Be sure to use 'man mc' to get loads of information relative to 'mc'.

fatmac 12-22-2014 02:14 PM

Once you delve into mc, you will be surprised at how much it can do.

rob.rice 12-22-2014 03:14 PM

Quote:

Originally Posted by fatmac (Post 5289135)
Once you delve into mc, you will be surprised at how much it can do.

it's my goto program for working on the file system
I always have it running in an xterm
it makes it simple to do the almost impossable
like work with files that have spaces in there names
(downloaded videos I would NEVER!EVER! include a space in a file name )

Randicus Draco Albus 12-22-2014 07:48 PM

I echo onebuck's advice. Become accustomed to checking man pages. They usually have the answers to most "frequently asked questions," including the locations of configuration files. mc's man page in particular has extensive information on colours.

CrazyCatLover 12-24-2014 07:08 AM

Hi, after a few days...
tried everything mentioned, but it doesnt work or not how i wanted it. (using Debian stable)
I found that my midnight commander was actually using the env COLORTERM=gnome-terminal.
So i realise that bash and gnome terminal was the same thing, i think?

Under gnome terminal, edit, profile perferences, color
I found that gnome is actually forcing the mc to use a specific color palette scheme, i can change it and it will change the mc color, but every other program using color in the terminal will change too, so does anyone know how to fix it?

Randicus Draco Albus 12-24-2014 07:13 PM

Install a different terminal (xfce4-terminal, LXDE terminal, Sakura, etc.) and in the line COLORTERM=gnome-terminal, change gnome-terminal to the new terminal?
(If that does not work, you could always replace Gnome with a different GUI.:D)

Diantre 12-24-2014 08:12 PM

Quote:

Originally Posted by CrazyCatLover (Post 5288868)
I need to know how to check the current colour for mc and how to change it.

Ok. Midnight Commander comes from upstream with several "skins" as .ini files. These skins are used to change the colors in the program. For instance, the Slackware package installs these files:

Code:

usr/share/mc/skins/modarin256.ini
usr/share/mc/skins/dark.ini
usr/share/mc/skins/modarin256root-defbg.ini
usr/share/mc/skins/mc46.ini
usr/share/mc/skins/darkfar.ini
usr/share/mc/skins/modarcon16root.ini
usr/share/mc/skins/default.ini
usr/share/mc/skins/modarcon16-defbg.ini
usr/share/mc/skins/gotar.ini
usr/share/mc/skins/modarcon16.ini
usr/share/mc/skins/modarin256-defbg.ini
usr/share/mc/skins/nicedark.ini
usr/share/mc/skins/double-lines.ini
usr/share/mc/skins/sand256.ini
usr/share/mc/skins/modarin256root.ini
usr/share/mc/skins/xoria256.ini
usr/share/mc/skins/featured.ini
usr/share/mc/skins/modarcon16root-defbg.ini

To use one of these skins, you start mc with the -S parameter:

Code:

$ mc -S gotar
That makes mc use the /usr/share/mc/skins/gotar.ini skin, and so on.

Another way to use skins (the way I do it) is to use the MC_SKIN environment variable. I export it in my ~/.bashrc file. Midnight commander looks for the skin defined in MC_SKIN in ~/.local/share/mc/skins first.

Creating one of these skins is rather simple, just look at the provided example skins and write your own, here's the one I'm currently using:

Code:

[skin]
        description=Midnight (Transparent)

[Lines]
        horiz=─
        vert=│
        lefttop=┌
        righttop=┐
        leftbottom=└
        rightbottom=┘
        topmiddle=─
        bottommiddle=─
        leftmiddle=├
        rightmiddle=┤
        cross=┼
        dhoriz=─
        dvert=│
        dlefttop=┌
        drighttop=┐
        dleftbottom=└
        drightbottom=┘
        dtopmiddle=─
        dbottommiddle=─
        dleftmiddle=├
        drightmiddle=┤

[core]
        _default_=lightgray;default
        selected=white;blue
        marked=yellow;
        markselect=yellow;blue
        gauge=;yellow
        input=brightgreen;
        reverse=brightgreen;blue

[dialog]
        _default_=brightcyan;blue
        dfocus=yellow;black
        dhotnormal=brightred;
        dhotfocus=yellow;black

[error]
        _default_=white;red
        errdhotnormal=yellow;
        errdhotfocus=yellow;blue

[filehighlight]
        directory=brightcyan;
        executable=brightgreen;
        symlink=red;
        stalelink=brightred;
        device=green;
        special=brightblue;
        core=brightred;yellow
        temp=magenta
        archive=cyan;
        doc=brown;
        source=green;
        media=white;
        graph=brightmagenta;
        database=blue;

[menu]
        _default_=white;blue
        menuhot=brightgreen;
        menusel=brightcyan;black
        menuhotsel=yellow;black
        menuinactive=lightgray;blue

[popupmenu]
        _default_=lightgray;default
        menusel=white;blue
        menutitle=white;red

[help]
        _default_=lightgray;blue
        helpitalic=brightcyan;
        helpbold=brightgreen;
        helplink=white;
        helpslink=yellow;blue

[editor]
        _default_=lightgray;default
        editbold=yellow;blue
        editmarked=white;blue
        editwhitespace=brightblue;default
        editlinestate=brightgreen
        bookmark=white;red
        bookmarkfound=black;green
        editrightmargin=brightblue;blue

[viewer]
        viewunderline=brightgreen;black

[diffviewer]
        _default_=lightgray;black
        added=brightgreen;
        changedline=cyan;
        changednew=yellow;
        changed=;brown
        removed=;blue
        folder=brightblue;
        error=white;red

[buttonbar]
        hotkey=lightgray;black
        button=white;blue

[statusbar]
        _default_=white;blue

To get all the details, read the manpage. Everything I mentioned above is right there in the manpage. ;)

Randicus Draco Albus 12-24-2014 08:50 PM

Are you sure it is a skin issue? The part of the problem's description that stands out for me is this:
Quote:

Originally Posted by CrazyCatLover (Post 5289956)
I found that gnome is actually forcing the mc to use a specific color palette scheme, i can change it and it will change the mc color, but every other program using color in the terminal will change too, so does anyone know how to fix it?

Although my experience is not exhaustive, I have never seen MC's colour schemes affect other applications, even terminal applications launched with MC. What CrazyCatLover describes sounds like a Gnome issue to me.

Edit:
On second thought, it appears CrazyCatLover is changing MC's colours by using Gnome, instead of MC's configuration file. So you are probably correct. :o

Diantre 12-24-2014 09:00 PM

Quote:

Originally Posted by Randicus Draco Albus (Post 5290201)
On second thought, it appears CrazyCatLover is changing MC's colours by using Gnome, instead of MC's configuration file.

That's what I thought actually. Let's wait until he/she tries the skin stuff and we'll see how to proceed.

CrazyCatLover 12-25-2014 02:01 AM

Ok, good news, i did it though i still dunno some stuff.
I still have no idea why the gnome-terminal does what it does, so anyone who knows do let me know.
I realise why changing the colors in ~/.config/mc/ini doesnt not work, i think its because i have the line above
skin=default
so no matter what color you change, it doesnt matter as it still uses the default skin.(let me know if i am wrong)
quote from man
"A skin-file is searched on the following algorithm (to the first one
found):

1) command line option -S <skin> or --skin=<skin>
2) Environment variable MC_SKIN
3) Parameter skin in section [Midnight-Commander] in config
file.
4) File /etc/mc/skins/default.ini
5) File /usr/share/mc/skins/default.ini
"
Easiest way
What i did was just to open the /usr/share/mc/skins/default.ini file, just edit the file (make sure that color is available) save it and your done. You will need to use root to do this, i have no idea how to use normal account, seems locked to read-only.
Thanks everyone for all the tips, very much appreciated.

Randicus Draco Albus 12-25-2014 02:19 AM

I change skin=default in ~/config/mc/ini to skin=name_of_skin.

Diantre 12-25-2014 03:00 AM

Quote:

Originally Posted by CrazyCatLover (Post 5290249)
What i did was just to open the /usr/share/mc/skins/default.ini file, just edit the file (make sure that color is available) save it and your done. You will need to use root to do this, i have no idea how to use normal account, seems locked to read-only.

What I do is copy one of the skins in /usr/share/mc/skins/ to ~/.local/share/mc/skins/. I make my modifications there and then export the MC_SKIN variable with the skin name I wish to use.

Just below the text you quoted from the man page, it reads:

Quote:

Command line option, environment variable and parameter in config file may contain the
absolute path to the skin-file (with the extension .ini or without it). Search of
skin-file will occur in (to the first one found):

1) ~/.local/share/mc/skins/
2) @sysconfdir@/mc/skins/
3) /usr/share/mc/skins/
Which is pretty much self-explanatory. If you want to use your local directory, put one or more skins there and use one of the three methods to select the skin: command line option, environment variable or parameter in the configuration file.


All times are GMT -5. The time now is 04:24 PM.