You are not logged in.

#1 2017-07-19 13:27:53

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Simple Colour Picker

Check out all the options for yad dialog - it is becoming a hugely useful tool these days. One of them is for a colour picker, which can be run with:

 yad --color --button=OK --undecorated --center

When you click "OK", the colour value (#xxxxxx) is output to the terminal.

I have this in the Accessories section in my menu.xml:

    <item label="Colour Picker">
        <action name="Execute">
            <command>yad --color --undecorated --button=OK --center</command>
        </action>
    </item>

And in ./bash_aliases I have

alias color='yad --color --button=OK --undecorated  --center'

color-picker.th.png


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#2 2017-07-19 14:01:58

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,654
Website

Re: Simple Colour Picker

That is nice! Makes gcolor2 unnecessary.


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

#3 2017-07-19 16:01:17

cpoakes
Member
Registered: 2016-12-02
Posts: 108

Re: Simple Colour Picker

Very nice. Added to my toolbox.

Offline

#4 2017-07-20 09:30:10

Steve
Member
Registered: 2017-01-03
Posts: 642

Re: Simple Colour Picker

Cool, thanks Damo.

Offline

#5 2017-07-20 13:19:41

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,654
Website

Re: Simple Colour Picker

damo wrote:

I have this in the Accessories section in my menu.xml:

    <item label="Colour Picker">
        <action name="Execute">
            <command>yad --color --undecorated --button=OK --center</command>
        </action>
    </item>

Come to think of it, how does this work? Without a terminal, where does the return colour value go?  (I suppose it might be found in ~/.xsession-errors.) It might be nice to trigger a little script that put the return value into the clipboard instead of running yad directly?


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

#6 2017-07-20 17:48:59

cpoakes
Member
Registered: 2016-12-02
Posts: 108

Re: Simple Colour Picker

My version:

yad --title="Select Color" --color --center | xsel -ib

This saves the result to the clipboard. If you omit "--button", you get both a cancel and an OK button. (I also prefer titled to undecorated). Xsel is standards compliant so I can only assume it is well-behaved with a clipboard manager (I don't use one).

p.s. You'll have to package that as:

sh -c "yad --title='Select Color' --color --center | xsel -ib"

for obmenu, or:

<command>sh -c &quot;yad --title='Select Color' --color --center | xsel -ib&quot;</command>

if you're editting menu.xml directly.

Last edited by cpoakes (2017-07-20 18:20:42)

Offline

#7 2017-07-20 19:00:27

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Re: Simple Colour Picker

^ Thanks for that. I am working on something along those lines ATM.


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#8 2017-07-20 20:18:27

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,028

Re: Simple Colour Picker

Much nicer than my OB Menu entry:

yad --color
yad --font

Both excellent conky tools.  Of course you'd be using them with graphics stuff.

Thank you.


Debian 12 Beardog, SoxDog and still a Conky 1.9er

Offline

Board footer

Powered by FluxBB