You are not logged in.

#1 2012-08-05 18:41:28

djpohly
Member
Registered: 2007-08-14
Posts: 23

stint: suckless-style color grabber

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. smile

For example, a more "graphical" color identifier:

stint | sed -u 's/.*/& ^bg(&)     ^bg()/' | dzen2

Any other cool ideas?


AUR: stint-git
Github: djpohly/stint

Offline

#2 2012-08-05 21:32:32

hunterm
Member
From: the series of tubes
Registered: 2010-07-30
Posts: 20

Re: stint: suckless-style color grabber

Useful for when you're making a theme or something like that and you want a specific color. Thanks.

Offline

#3 2012-08-06 12:18:39

eco
Member
From: netherlands
Registered: 2009-07-02
Posts: 13

Re: stint: suckless-style color grabber

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."

Offline

#4 2012-08-07 12:39:48

chneukirchen
Member
Registered: 2010-02-11
Posts: 100

Re: stint: suckless-style color grabber

packer -S xoris

xoris 0.1e - grabs color from the screen & dumps it to stdout.
Copyright (c) 2004,2005,2006 Alexander Gromnitsky <alexander.gromnitsky@gmail.com>
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

Offline

#5 2012-08-07 13:58:10

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: stint: suckless-style color grabber

Thanks.
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.

Offline

#6 2012-08-07 21:31:58

djpohly
Member
Registered: 2007-08-14
Posts: 23

Re: stint: suckless-style color grabber

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

Offline

#7 2012-09-02 06:34:51

likytau
Member
Registered: 2012-09-02
Posts: 121

Re: stint: suckless-style color grabber

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)

Offline

#8 2012-09-02 12:03:19

djpohly
Member
Registered: 2007-08-14
Posts: 23

Re: stint: suckless-style color grabber

Yep, and so does grep. ^_^

Offline

#9 2013-01-10 13:22:25

kaari
Member
Registered: 2011-08-12
Posts: 22

Re: stint: suckless-style color grabber

It's very nice, but it would be much more useful if it displayed colors in hexadecimal instead.

Offline

#10 2013-01-10 13:40:12

Trilby
Forum Moderator
From: Massachusetts, USA
Registered: 2011-11-29
Posts: 14,018
Website

Re: stint: suckless-style color grabber

@Kaari

printf "#%02X%02X%02X" $(stint)

Last edited by Trilby (2013-01-10 14:22:18)


InterrobangSlider
• How's my coding? See this page.
• How's my moderating? Feel free to email any concerns, complaints, or objections.

Offline

Board footer

Powered by FluxBB