I was playing with a program which changes the background image of root window, and I needed to change it back to default black, which was quite simple:

$ xsetroot -solid black

After that, I decided to explore a bit using only xsetroot.

1   Solid background color

The syntax is

$ xsetroot -<gray|grey>
$ xsetroot -solid <color_name|#RGB|#RRGGBB>

Some examples:

$ xsetroot -gray
$ xsetroot -solid gray
$ xsetroot -solid black
$ xsetroot -solid '#333'
$ xsetroot -solid '#334455'

2   Grid pattern

$ xsetroot -mod <1-16> <1-16> [-fg <color>] [-bg <color>]

Example:

$ xsetroot -mod 5 12 -fg black -bg gray
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjNOjbvQujSFsbPjmoQ7xB-1kqJU-ImAdRKv5qQDdmW_k_SWpHFyOqMDKTnGbQkHlIYFcBQWk-DBJ-N5JuwSS1Cwf4ZdGVh2sl388SBZTbjnMQwthkKaNBPW1Unt7W_2fpj1p28kTsgZI/s800/xsetroot-mod.png

3   Bitmap for pattern

The option is:

$ xsetroot -bitmap <image>

I believe that you need to give it a 2-color, black-and-white, and no bigger than 16x16 XBM (X Bitmap) file. It uses bitmap for pattern, not for image. If you want to show off wallpaper, you need to use other tools, such as feh or xv.

You can use convert from ImageMagick for the conversion, for example:

$ convert -type Bilevel -colors 2 source_image pattern.xbm
$ xsetroot -bitmap pattern.xbm

Using this blog’s favicon:

https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj78omNe1PxbwbI5WCogi5jYQNAbvttXuU29qZf73w8XruPzbXYOh6QlMeWEr_uY2rD4jiq1c2pNHSDk4-_wcPOpwns4Y-FZo4qpqoXLu6ENL7tErTg6VZY3vvgea9jtg3dgzRsNGW6C7k/s800/xsetroot-bitmap.png

If xsetroot isn’t happy with the file, it says something like:

xsetroot: bad bitmap format file: pattern.xbm

You can also use bitmap(1) to design the pattern and set to the saved file.