So it's by no means a BIG contribution, but I hacked up a tiny X color grabber called stint ("simple tint"). There's no UI; it just grabs the pointer and waits for you to click. As long as the left mouse button is held down, it outputs the color under the cursor to stdout. As a colorblind person, I needed something like this to avoid those "embarrassing" moments when someone tells me to click the green button.
For example, a more "graphical" color identifier:
stint | sed -u 's/.*/& ^bg(&) ^bg()/' | dzen2
Any other cool ideas?
wow thanks, I was looking for this!
It works great.
"All programs can be optimized, and all programs have bugs; therefore all programs can be optimized to one line that doesn’t work."
packer -S xoris
xoris 0.1e - grabs color from the screen & dumps it to stdout. Copyright (c) 2004,2005,2006 Alexander Gromnitsky <firstname.lastname@example.org> All rights reserved. Usage: xoris [-d display] [-r filename] [-vENh] -d host display to use -v show also XY coordinates -E don't exit after grab -N don't put newline at the end -r filename use alternate rgb.txt file -h this help
Another usage idea: if you want multiple colors and a single command/keybind, you can use killall and while stint like this (works for xoris as well):
killall stint || while stint; do :; done | dmenu
Note that it keeps the mouse grabbed, so you can't use it with a mouse menu.
chneukirchen: Hey, that's cool. I searched several times for something like this over the past year and somehow never ran across xoris. I did see grabc, but it didn't work consistently for me. Anyway, it's good to know there's a more feature-rich alternative out there. Personally, I prefer doing one thing and doing it well:
xoris stint | sed q xoris -d :1 DISPLAY=:1 stint | sed q xoris -E while :; do stint | sed q; done xoris -N stint | sed q | tr -d \\n xoris -r rgb.txt stint | sed q | xargs printf '%3d %3d %3d\n' | grep -Ff- rgb.txt
Procyon: Nice! Once stint has graceful EPIPE handling, you should be able to make a single-click version too:
set -o pipefail; while stint | sed q; do:; done | dmenu
For your particular usage, you could make it match the color to a database of color names, and print the name as well.
An example of what I mean can be found in GPick. It's much easier identification-wise than reading a hex code.
EDIT: NVM, I see xoris does that.
Last edited by likytau (2012-09-02 06:36:18)
Yep, and so does grep. ^_^