The officially official Devuan Forum!

You are not logged in.

#1 Yesterday 20:59:29

greenjeans
Member
Registered: 2017-04-07
Posts: 1,221  
Website

Simple color selector using Yad

We were talking about this on IRC and it seemed handy enough to be worth posting
a quick how-to for future reference. Yad has a built-in widget for color selection
based off the gtk color-selector, it looks almost identical to gcolor2 and the
Mate-color-selection utility. It's got an eyedropper for selecting color on your screen.

yad --color in terminal gets you the basic version. But there are other options
available with this command, see the yad man page for (most of) them. If you want
the color swatches you can use --gtk-palette but I don't find them to be
too useful. The --palette command can be used to pull up a palette file and
display the colors and their code in a drop down menu, and if you want the gui to
start every time with that dropdown already expanded, then add --expand-palette
to it as well. The --palette command by default uses /etc/X11/rgb.txt for a
palette file unless a different one is specified by adding a path to the command :
--palette=/path/to/file.txt, so it's possible to make a custom palette file, I made
one for my theme, but you have to follow the format in rgb.txt closely.

And there are some of the normal operators you can use too, to add a window title or
an icon, borders, etc. Here's the command i'm using:

yad --color --title='Color Selection' --window-icon=style --borders=15 --palette --expand-palette

If you want to add the ability for copying a selected color code into your clipboard,
you can install xsel and then pipe it to the clippy:

yad --color --title='Color Selection' --window-icon=style --borders=15 --palette --expand-palette | xsel -ib

Simple .desktop, drop it in ~/.local/share/applications to get a menu entry:

[Desktop Entry]
Name=Color Selection
Comment=Choose colors from the palette or the screen
Exec=sh -c "yad --color --title='Color Selection' --window-icon=style --borders=15 --palette --expand-palette | xsel -ib"
Icon=style
Terminal=false
Type=Application
Categories=Graphics; 

And that gets you this:
okavt0.png

Miyolinux has some cool videos on youtube about doing this and making menu entries for it. wink

Last edited by greenjeans (Yesterday 21:25:03)


https://sourceforge.net/projects/vuu-do/ New Vuu-do isos uploaded October 2025!
Vuu-do GNU/Linux, minimal Devuan-based Openbox and Mate systems to build on. Also a max version for OB.
Devuan 5 mate-mini iso, pure Devuan, 100% no-vuu-do. wink Devuan 6 version also available for testing.
Please donate to support Devuan and init freedom! https://devuan.org/os/donate

Offline

Board footer