{ datagubbe }


datagubbe.se » colshift - X11 color tool

colshift - X11 color tool

colshift is a POSIX shell script for manipulating X11 colors and outputting them in various fashions, such as text, HTML or GIF files. It can also create GIF files of arbitrary colors. It has no dependencies other than standard POSIX commands (I.E. awk, grep, printf, sed and tail).

This can be useful for example when picking new colors for use in a window manager, on a home page or in terminal emulators. In fact, since I'm an incurable config tweaker, I felt a certain need for a small program for quickly altering and previewing colors, particularly based on the existing X11 color table.

Due to the nature of POSIX shell GIF generation, colshift will give one error when linted with shellcheck. The error itself is SC2059, "Don't use variables in the printf format string", but I've yet to find another way to output the generated bytes. The POSIX spec states that "The printf utility was added to provide functionality that has historically been provided by echo". More information about echo and printf can be found here. I'm leaving it as-is. In case anyone can find a better way to do it, feel free to give me a poke.

Examples

Create a slightly brighter version of the always popular DarkSlateGray and preview it as a GIF using feh:

colshift -g DarkSlateGray 10 10 10 | feh - -Z --geometry 100x100

Colshift can also be used to create 1x1 pixel GIFs with arbitrary colors:

colshift -c F00D23 > illuminati_cuisine.gif

Download

The latest release is v1.0.1 (2020-07-27)

Extras

If your system lacks the required X11 color table file, the following can be used for testing:

Screenshot

colshift session
Example colshift session.