Fixing colors in Emacs themes in tmux

For years I’ve struggled with certain themes in Emacs having incorrect colors when run in the terminal (emacs -nw) but appearing correct in GUI Emacs. Finally found a solution - the issue was with tmux. The fix for me was to include this in my .tmux.conf:

set -g default-terminal 'screen-256color'
set -ga terminal-overrides ',*256col*:Tc'

This comes from There are a number of other similar suggested fixes in that thread if this doesn’t work.

One thing that made testing this easier is this script:

curl -s >

With the correct settings, each row of colors is an almost smooth gradient. With the incorrect settings, there are clear discrepancies in the gradient.

Home | Back to blog