LinuxCommandLibrary

xcolor

Pick a color from X screen

SYNOPSIS

xcolor [-rgb]

PARAMETERS

-rgb
    Outputs the color in rgb:RR/GG/BB format instead of the default #RRGGBB hexadecimal format.

DESCRIPTION

xcolor is a minimalist command-line utility for X Window System environments. It allows users to visually select a color from any pixel on their screen. Upon execution, the cursor transforms into a crosshair. Clicking with the mouse on any part of the screen captures the color value of that pixel. The color is then output to standard output in an RGB hexadecimal format (e.g., #RRGGBB), making it convenient for scripting or direct use in other applications that require color input. It's particularly useful for web developers, graphic designers, or anyone needing to sample colors from their desktop.

CAVEATS

Requires an active X display server to function; it is a GUI-dependent tool.
Provides minimal functionality, focusing solely on picking a single pixel color without advanced features.

DEFAULT OUTPUT FORMAT

By default, xcolor outputs the picked color in the common #RRGGBB hexadecimal format. This is widely compatible with HTML, CSS, and many graphics applications.

INTEGRATION WITH OTHER TOOLS

The output of xcolor can be easily piped to other command-line utilities. For instance, to copy the picked color to the clipboard, one might use:
xcolor | xclip -selection clipboard

HISTORY

xcolor is a long-standing utility within the X Window System's suite of basic client applications. Its simple and singular purpose reflects the original philosophy of X tools: small, focused utilities that do one thing well. It has been a consistent component of X client packages for decades, with its core functionality remaining unchanged since its early development.

SEE ALSO

xclip(1) (copy/paste to clipboard), gpick(1) (more advanced GUI color picker), xrandr(1) (X screen utilities), xwininfo(1) (X window information)

Copied to clipboard