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.
Update 2021-07-24: Bastian Bittorf has submitted a way of silencing
SC2059 by cleverly cheating solving it once and for all. Thanks!
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 -
Colshift can also be used to create 100x100 pixel GIFs with arbitrary colors:
colshift -c F00D23 > illuminati_cuisine.gif
Download
The latest release is v1.1 (2021-07-24)
Extras
If your system lacks the required X11 color table file, the following can be used for testing:
- rgb.txt, X11 colors.
- Example colshift HTML output from the above file.
Screenshot
Example colshift session.