XCOLOR(1)

NAME
xcolor - lightweight color picker for X11

SYNOPSIS
xcolor [-f NAME | -c FORMAT] [-s [SELECTION]] [-S SCALE] [-P PREVIEW_SIZE] [-v] [-h]

DESCRIPTION
xcolor is a lightweight color picker for X11. Use mouse to select colors visible anywhere on the screen to get their RGB representation.

By default, the selected color is printed to the standard output.

OPTIONS

-f NAME, --format NAME
    Specify output format. Possible values for NAME are hex, HEX, hex!, HEX!, rgb, and plain. See FORMATTING for an explanation of different formatting options. Conflicts with --custom.

-c FORMAT, --custom FORMAT
    Specify template for custom output format. See CUSTOM FORMATTING for an explanation of template syntax. Conflicts with --format.

-s [SELECTION], --selection [SELECTION]
    Save output to X11 selection. Possible values for SELECTION are clipboard, primary and secondary. If SELECTION is not supplied, clipboard is used.

-S, --scale
    Magnification scale of the picker, defaults to 8

-P, --preview-size
    Pixel size of the picker, defaults to 255

-v, --version
    Print version information and exit.

-h, --help
    Print help message and exit.

FORMATTING
By default, the color values are printed in lowercase hexadecimal format. The output format can be changed using the --format NAME switch. The possible NAME values are:

hex Lowercase hexadecimal (default)

HEX Uppercase hexadecimal

hex!
    Compact lowercase hexadecimal

HEX!
    Compact uppercase hexadecimal

rgb Decimal RGB

plain
    Decimal with semicolon separators

The compact form refers to CSS three-letter color codes as specified by CSS Color Module Level 3. If the color is not expressible in three-letter form, the regular six-letter form will be used.

  CUSTOM FORMATTING
The --format switch provides quick access to some commonly used formatting options. However, if custom output formatting is desired, this can be achieved using the --custom FORMAT switch. The FORMAT parameter specifies a template for the output and supports a simple template language. FORMAT templates can contain special expansions that are written inside %{...} blocks. These blocks will be expanded into color values according to the specifiers defined inside the block. Here are examples of valid format strings and what they might translate to:
    Format String | Example Output
    %{r}, %{g}, %{b} | 255, 0, 100
    Green: %{-4g} | Green: ---7
    #%{02hr}%{02hg}%{02hb} | #00ff00
    %{016Br} | 0000000000000011
Expansion blocks in format strings always contain a channel specifier (r for red, g for green, and b for blue). Additionally, they can contain an optional number format specifier (h for lowercase hexadecimal, H for uppercase hexadecimal, o for octal, B for binary, and d for decimal) and an optional padding specifier consisting of a character to use for padding and the length the string should be padded to. The diagram bellow illustrates how we can use these rules to decode a formatting template:
    %{016Br}
      | |||
      | ||`- Channel (red)
      | |`-- Number format specifier (binary)
      | `--- Padding length (16)
      `----- Character to use for padding (0)
The output is the contents of the red color channel formatted in binary and padded with zeroes to be sixteen characters long.

ENVIRONMENT

XCOLOR_FOREGROUND
    Disable daemon mode. Because of the way selections work in X11, xcolor forks into background when --selection mode is used. This behavior can be disabled by defining XCOLOR_FOREGROUND environment variable.

AUTHORS
Samuel Laurén <samuel.lauren@iki.fi> Callum Osmotherly <acheronfail@gmail.com>