Nmcli output color mapping

(RL 8.4 )

I’m trying to find the color/meaning mapping for output from

nmcli con show

The nmcli man page references terminal-colors.d(5)

The man page terminal-colors.d(5) refers to:
$XDG_CONFIG_HOME/terminal-colors.d
$HOME/.config/terminal-colors.d
/etc/terminal-colors.d

… but none of these exist and I can’t find any non utility-specific color files.

Any suggestions ?

I am under the impression that you can create a directory named terminal.colors.d at any of the above mentioned locations and then put files into that directory that will allow you to change the default colours and colour sequences. If no terminal.colors.d directory is found at those locations then the defaults are used, so the only time you would want a terminal.colors.d directory would be if you want to change the default colour sequences.

So if that’s what you want to do then go ahead and create a terminal.colors.d directory and make the changes that you need.

This will rely on the affected program recognizing and using the settings in terminal.colors.d, and I don’t know how many really do that. I write stuff using ncurses and as far as I know when one of my programs says to print that letter in green the letter gets printed in green; I don’t know what changes terminal.colors.d would make in that behaviour.

Note, however, this is all something that I’ve never tried or really looked at or into until now. You can try it and see what happens anyway; the worst thing that could happen is that you can delete that directory again and be back to where you are now.

Cheers Frank.

I don’t currently need to change them - I just want to know what they mean… though I suppose I could just try create a set as you say… but … that shouldn’t really be necessary…so… assuming your take is correct and terminal-colors.d hasn’t been superceeded/moved etc. what I would like to know is…

…in the absence of terminal-colors.d, where does nmcli get its default colors from or if the defaults are hard coded where is that/are they documented ?

Look at lines 39 through 80.

Yep… and lines 514 - 541 are helpfull in making sense of 39 - 80 though I’d been off and discovered this very nice SO answer on ansi color codes before I started looking through the code and spotted them.

I was hoping it wouldn’t come down to looking at code: with code you have to look at all references to a given variable/const to know what the final result is/how it is being used and in doing that you have to understand the code. I haven’t really used C/C++ in decades and can’t make sense of some of the syntax there … but it does seem lines 39 - 80 correlate directly with the output. More generally, having to read code to understand the UI the code implements kind of defeats the purpose of coding the UI in the first place.

I’ll probably just start using the --fields option and try to ignore the colours.

Appreciate the help !