Enabling 256 Colors in tmux

It turns out that tmux supports 256 colors if you read the docs

I've been using ssh and tmux for a while to do work on my home computer when I'm away from it1. I was annoyed that tmux didn't support very many colors, but it didn't bother me that much because I don't do that much in my remote ssh sessions that needed more colors. But then I read some documentation that said that tmux supports 256 colors, and even though I knew I didn't need it, I knew I had to have it.

It turns out that all you need to do is to set your TERM within tmux to screen-256color, and the easiest way to do that is to edit your ~.tmux.conf and add the following line:

~.tmux.conf
set -g default-terminal "screen-256color"

And that's it. It sometimes pays to read the documentation, but that also implies that you know what you're looking for, which is kind of a chicken and egg problem with documentation, but that's another rant for another day.

This article was posted on 1 Dec 2020 and I haven't looked at it since.

Footnotes:

1

The definition of 'work' depends on what time of day is is