27

I tried gpick, gcolor2, gcolor3, pick, pychrom and none of them seem to work with Wayland. I am running Arch Linux 64-bit with GNOME 3.22.1 through XWayland (default since 3.22.x). I don't want to change into an X session just to pick a colour.

Anyone had success with this?

  • None that I know of... afaik the dbus api that should allow apps to access those resources is not implemented yet. – don_crissti Oct 31 '16 at 12:50
  • Any update on this? – tanenbring Nov 16 '17 at 17:51
  • i also stuck on X11 with gcolor2. seems that gcolor3 is on the way but i dont expect it too fast – Thomas Fellinger Dec 5 '17 at 8:55
  • 2
    I don't think this is currently possible with wayland, because wayland applications don't have access to the surfaces of other apps. – Thayne Feb 10 '18 at 23:48
9

grim is a screenshot tool for Wayland that is able to do that:

grim -g "$(slurp -p)" -t ppm - | convert - -format '%[pixel:p{0,0}]' txt:-

After selecting a point on the screen with the mouse, it produces output like this:

# ImageMagick pixel enumeration: 1,1,65535,srgb
0,0: (40,85,119)  #285577  srgb(40,85,119)
| improve this answer | |
  • 1
    Note that grim uses the wlr-screencopy protocol and slurp uses wlr-layer-shell. These should be supported by wlroots-based compositors, but probably not any others. – tobib Nov 26 '19 at 12:07
  • 3
    I've added the following line to my Sway config. It lets me select a pixel on the screen and puts its color as a hex value on the system clipboard: bindsym $mod+Shift+p exec grim -g "$(slurp -p)" -t ppm - | convert - -format '%[pixel:p{0,0}]' txt:- | tail -n 1 | cut -d ' ' -f 4 | wl-copy – Matthias Braun Apr 5 at 12:12
  • I get slurp: invalid option -- 'p'. The man page for slurp doesn't list p. – Erhannis Jun 4 at 20:13
3

No, security requires only a trusted app to be permitted access to the output of other apps.

"In GNOME, you can use Screenshot tool (available in overview or as Printscreen hotkey or as gnome-screenshot command) to capture a screenshot of the full desktop or a particular window."

Then use gimp/krita/etc to get the color off the image.

https://fedoraproject.org/wiki/How_to_debug_Wayland_problems#Screen_capture_is_not_available_with_usual_apps

| improve this answer | |
  • KolourPaint serves that purpose too. Thank you! – Antonio Vinicius Menezes Medei May 14 '19 at 18:57
  • @AntonioViniciusMenezesMedei KolourPaint captures a black screenshot on my Debian 10 (Buster) running Wayland. I believe there has been some changes in the new Wayland version as I wasnt facing issues of black screen in Debian 9 (I was using a simple but cool app Picker previously, which is no longer working). – Sufian Aug 4 '19 at 14:56
  • Gnome can publish a color picker(trusted) like screenshot tool – shantanu Apr 23 at 8:14
1

There is azote wallpaper manager for wayland and it has a built in color picker https://github.com/nwg-piotr/azote

Also you can use:

grim -g "$(slurp -p)" -t ppm - | convert - -format '%[pixel:p{0,0}]' txt:-

or if you are using sway wm:

swaynag -t warning -m "$(grim -g "$(slurp -p)" -t ppm - | convert - -format '%[pixel:p{0,0}]' txt:-)"
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.