grabc

Tool to identify pixel colors on X
git clone https://git.sinitax.com/muquit/grabc
Log | Files | Refs | README | Upstream | sfeed.txt

README.md (2905B)


      1# grabc
      2A command line tool to identify a pixel color on an X Window.
      3
      4When this program is run, the mouse pointer is grabbed and changed to
      5a cross hair and when the mouse is clicked, the color of the clicked
      6pixel is written to stdout in hex prefixed with #
      7
      8This program can be useful when you see a color and want to use the
      9color in xterm or your window manager's border but no clue what the
     10name of the color is. It's silly to use a image processing software
     11to find it out. (That's how I described it 20 years ago, so keeping it 
     12this way for historical reasons - Apr-11-2018).
     13
     14# Synopsis
     15
     16```
     17grabc v1.0.2
     18A program to identify a pixel color of an X Window
     19by muquit@muquit.com https://www.muquit.com/
     20
     21Usage: grabc [options]
     22Where the options are:
     23 -v         - show version info
     24 -h         - show this usage
     25 -hex       - print pixel value as Hex on stdout
     26 -rgb       - print pixel value as RGB on stderr
     27 -W         - print the Window id at mouse click
     28 -w id      - window id in hex, use with -l +x+y
     29 -l +x+y    - pixel co-ordinate. requires window id
     30 -d         - show debug messages
     31 -a         - Print all 16 bits of color. Default is high order 8 bits
     32Example:
     33* Print pixel color in hex on stdout:
     34   $ grabc
     35* Show usage:
     36   $ grabc -h
     37* Print Window Id (Note the upper case W):
     38   $ grabc -W
     39* Print pixel color of Window with id 0x13234 at location 10,20
     40   $ grabc -w 0x13234 -l +10+20
     41```
     42
     43# How to compile
     44Older version of this program is available on Ubuntu. However, if you need to get the latest version, you have to compile it yourself.
     45
     46* You will need ```libx11-dev``` package if you are on Ubuntu. 
     47```
     48    sudo apt-get -y install libx11-dev
     49```
     50* To compile, at the shell prompt, type:
     51```
     52    make
     53```    
     54
     55* To install, at the shell prompt, type:
     56```
     57    sudo make install
     58```
     59The binary *grabc* will be install in /usr/local/bin/ and the man page *grabc.1*
     60will be installed in /usr/local/share/man/man1/
     61
     62If you want to install it in some other directory:
     63```
     64    make DESTDIR=/tmp/grabc install
     65```
     66
     67* If you want to create a debian package, install [fpm](https://github.com/jordansissel/fpm) first, then type:
     68```
     69    make deb
     70```
     71
     72* Install the debian package:
     73```
     74    sudo dpkg -i ./grabc_1.0.2-1_amd64.deb
     75```
     76
     77* To uninstall the debian package:
     78```
     79    sudo dpkg -r grabc
     80```
     81
     82# Know Issues
     83
     84* If color grabbed from root window, it might always show #000000 (Depending
     85on the Window Manager in use)
     86
     87
     88# ChangeLog
     89
     90# v1.0.2
     91 * Was not working properly on Ubuntu Terminal. It was using default Colormap. Do not use default colormap, rather get it from window attributes. 
     92 * If could not get XImage from target window, it is probably root window,
     93    so try to grab it from there.
     94* Added some options
     95* Color can be grabbed from a specific location
     96
     97* Change Copyright to MIT from GNU GPL
     98
     99(Apr-10-2018)
    100
    101# v1.0.1
    102* first cut
    103
    104(march-16-1997)
    105
    106
    107# License
    108
    109MIT