urxvt+tmux+256 colors

Tonight, I wanted to make x11/rxvt-unicode and sysutils/tmux to work with 256 colors.

It took me around 2 hours to get this working.

So how to get that working?

Step 1

uninstall devel/ncurses
install devel/ncurses-devel

Step 2

Reinstall all ports that used to depend on devel/ncurses.
For me it was only x11/rxvt-unicode.

Step 3

In your ~/.Xdefaults add this line
Code:
URxvt.termName: xterm-256color

Depending on your window manager, you may need to run
$ xrdb ~/.Xdefaults

Step 4

Restart urxvtd (if you're using it).

Step 5


Run this script to check if it works

Screenshoots

Without tmux:
6JFPggr.png


With tmux:
yt25aPK.png


Tips

Judging by source of /usr/ports/Mk/bsd.ncurses.mk you can set
Code:
NCURSES_PORT=devel/ncurses-devel
in /etc/make.conf to automatically use devel/ncurses-devel next time you reinstall your system (instead of devel/ncurses).

Note: Haven't tested this, but it should work :)

References

1) http://blog.ijun.org/2011/09/install-tmux-on-freebsd-tutorial-step.html
2) Lots of improvisation and experimenting
 
vermaden said:
Are there any real world advantages of having 256 colors at terminal? :)

The only one that I can think of is:
Now I can make better vim theme :)


My previous vim theme (universal-blue) was awesome because it used only 16 colors, had dark background and looked very similar in console, terminal and gui.

However 16 are just not enough to create good bright theme, because many color combinations simply look too dim. Hopefully 255 colors will resolve this problem for me :)


Q: So why did I switch to bright theme?
A: I followed oculists commendation.
 
mutt-colors-solarized has been working nicely here to read usenet feeds with mutt; though sometimes part of the screen is blank or mis-translated. But the color differentiation within the posts makes up for it... somewhat complex to set up, and nowadays, anyway, most of the usenet groups are mostly spam (Exceptions: muc.lists.freebsd.current for example... )
 
no-term.jpg
This is an old thread but I am having some strange issues.

I have rxvt-unicode installed and colors work inside script files, running ls -FG also output colors but doing tree . there's no color output. I have a solarized theme.

In the screenshot above you can see that there should be colors in the terminal, you can see the pkg info for rxvt-unicode, the second column first window shows tree . and no colors, the second window shows the perl script with synthax highlighting, the third window shows ls -FG the first column second window shows the perl script output.

why doesn't the commands like tree or just basic ls show color output?

I can do things like setenv CLICOLOR in my .cshrc file but that only makes ls show colors.

my .Xresources has "URxvt.termName: xterm-256colors"

here's my env

Code:
TERM=rxvt-unicode-256color
COLORTERM=rxvt-xpm
TERMINFO=/usr/local/share/misc/terminfo.db
COLORFGBG=11;default;8
WINDOWID=25165834
DISPLAY=:0
VENDOR=amd
LOGNAME=me
PAGER=more
OSTYPE=FreeBSD
MACHTYPE=x86_64
XAUTHORITY=/home/me/.Xauthority
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
EDITOR=vi
HOST=host
GDK_SCALE=2
PWD=/home/me
GROUP=me
USER=me
HOME=/home/me
WINDOWPATH=9
SHELL=/bin/tcsh
HOSTTYPE=FreeBSD
DESKTOP_STARTUP_ID=i3/i3-sensible-terminal/1025-18-blubee.me_TIME3055688
GDK_DPI_SCALE=1
BLOCKSIZE=K
SHLVL=1
 
But the output of ls -G is colored. So clearly it works. ls defaults to no colors, but you can set CLICOLOR=1 in your env if you want to enable colors permanently.

What is tree? At first I thought it was sysutils/tree but the output doesn't look like it.

it is sysutils/tree it's just cropped a bit because of the way I arranged the screenshot.

with the setenv CLICOLORS yes, ls is colored but like I mentioned sysutils/tree isn't colored or maybe some of those types of shell commands just don't output colors.
 
it is sysutils/tree it's just cropped a bit because of the way I arranged the screenshot.

with the setenv CLICOLORS yes, ls is colored but like I mentioned sysutils/tree isn't colored or maybe some of those types of shell commands just don't output colors.

According to the man page you need to set LS_COLORS:
... which is colorized ala dircolors if the LS_COLORS environment variable is set and output is to tty.

It looks like there is also an option to force color output without LS_COLORS set:
-C
Turn colorization on always, using built-in color defaults if the LS_COLORS environment variable is not set. Useful to colorize output to a pipe.
 
Back
Top