colshift - list, manipulate and output X11 colors as text, GIF or HTML.
Usage:
  colshift [OPTION] [ARGUMENTS]
Options:
  -h         Show this help.
  --help     Show extensive help and program information.
  --html     Generate an HTML document containing all colors on the current
             system. The HTML code will be written to stdout.
  -m, --modify COLORNAME RED [GREEN] [BLUE]
             Look up COLORNAME among available X11 colors and print the
             resulting RGB values after applying each delta  respectively.
             E.G. if RED is -10, subtract 10 from the Red value in the
             original color. If RED alone is supplied, it will be used for
             all color values.
  -g, --gif COLORNAME RED [GREEN] [BLUE]
             Like -m, but write the resulting color as a GIF87a file to
             stdout.
  -c, --colorgif HEXPAIRS
             Generate a GIF87a colored with the given hex pairs and write
             it to stdout.

 Optionless Usage
==================
Colshift can be invoked without options:
  colshift [COLORNAME] [RED] [GREEN] [BLUE]

The color values RED, GREEN and BLUE are assumed to be decimal integers.
They can be positive, E.G. 100 or negative, E.G. -100.

If no options are given, colshift will attempt to look up COLORNAME
in the list of X11 colors. If no color values are given, any matching
colors will be listed together with their values in decimal and hexadecimal
notation.

If supplied, RED, GREEN and BLUE will be used as deltas to calculate a new
color value, E.G.
  colshift DarkSlateGray 10 -10 10
Will output
  DarkSlateGray
    #2f4f4f / 47, 79, 79
    #394559 / 57, 69, 89

If only one delta value is supplied, it will be used for all three color
values, E.G.
  colshift DarkSlateGray -15
Will output
  DarkSlateGray
    #2f4f4f / 47, 79, 79
    #204040 / 32, 64, 64

 Usage With -g or -m
=====================
If -g, --gif or -m, --mod are used, at least COLORNAME and RED must be
supplied, otherwise the behavior is the same as Optionless Usage.

 GIF87a Creation
=================
The GIF created is a 100x100 pixel GIF87a. It can be redirected to
a file or piped to a suitable image viewer.

 Examples
==========
List all X11 colors:
  colshift

Create an HTML file with all X11 colors:
  colshift --html > all_colors.html

List all X11 colors matching slate:
  colshift slate

Increase all values of DarkSlateGray by 15 and print the result:
  colshift DarkSlateGray 15

Increase blue value of SteelBlue4 by 30 and print the result:
  colshift SteelBlue4 0 0 15

Decrease the green value of DeepSkyBlue3 by 15 and print the result:
  colshift DeepSkyBlue3 0 -15 0

Decrease the green value of DeepSkyBlue3 by 15, generate a GIF of the
result and display the GIF in a 100x100 window using feh:
  colshift -g DeepSkyBlue3 0 -15 0 | feh - -Z --geometry 100x100

Generate a GIF with the color #BADFAD and display it in a 100x100 window
using feh:
  colshift -c BADFAD | feh - -Z --geometry 100x100

 Configuration
===============
By default, colshift assumes a list of X11 color names is available
in "/etc/X11/rgb.txt". This path can be changed by creating a file
in your home directory called ".colshiftrc", E.G.:
  echo "/path/to/colorlist/rgb.txt" > "/home/carls/.colshiftrc"

 Dependencies
==============
Colshift is written in POSIX sh and assumes the following compliant
commands are available: awk, grep, printf, sed, tail.

 License
=========
colshift 1.1 (c) 2020 Carl Svensson.
Shellcheck SC2059 workaround by Bastian Bittorf.
Usage of the works is permitted provided that this instrument is
retained with the works, so that any entity that uses the works is
notified of this instrument.
DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
