256 Colour Editing in Linux

For many years I’ve been using SSH sessions on my PC to talk to headless SBCs such as Raspberry Pi. I HATE monochrome editing and almost as badly hate 16-colour editor. Be wary before going further that 256-colours is not for every situation.

Disclaimer out of the way – with Nano editor and my chosen PC tool Mobaxterm I’ve been stuck in that last-century mode for some time – and Mobaxterm documentation doesn’t help – I’m as good as anyone at finding solutions on Google – but wasted many an hour on this one – until now.

Mobaxterm edit session

Mobaxterm, only when creating or EDITING a session has the option to change the default 16-colour mode (xterm) to 256 colours (xterm-256color). See that EDIT SESSION on the right?

Once in there, under BASIC SSH SETTINGS – TERMINAL SETTINGS – there is an option TERMINAL TYPE and XTERM-256COLOR is in there – see below.

Mobaxterm colour setup

With that set, I go onto my SBC SSH session and open MC (Midnight commander) – not MCEDIT. If MC is not installed – apt install mc (assuming ROOT user – if not, sudo apt install mc

MC Config appearance

In mc-options-appearance – not easy to find with the default colours – you can select 256 colour themes – some are built-in, others can be added. MODAR-256THIN is my current favourite.

From there – when editing a file, use MCEDIT which aside from it’s ropey external copy-paste provides a comfy environment for editing files. See example below… note the rather awful default terminal colours above…

Unsubtle terminal colours
MCEDIT colours with the appropriate theme

That black background next to opening braces above is a trailing SPACE – not sure why the theme designer(s) made that happen..


One thought on “256 Colour Editing in Linux

  1. black spaces: it’s not a theme fault… it’s the editor telling you that you forgot some spaces there, which should not be…

    thank the editor for that, not blame: spaces at EOL could cause issues, often, ESPECIALLY if they come after a “\” sign in bash (which states current line continues on the following one…)

    remove them, lines should end with a character, NOT a space…

Leave a Reply

Your email address will not be published. Required fields are marked *

Leave the field below empty!

The maximum upload file size: 512 MB. You can upload: image, audio, video, document, spreadsheet, interactive, text, archive, code, other. Links to YouTube, Facebook, Twitter and other services inserted in the comment text will be automatically embedded. Drop file here