Color pickers aren't working on wayland, anyone else seeing this?

Across several apps, it seems like anything that’s meant to pick a color from the screen isn’t working at all. Just returns #000 black. Either that or they’re disabled altogether (though I suspect that the devs are doing that on purpose because of the bug.)
I’d be surprised if this is simply a Wayland restriction, because the screenshot tools seem to still work.

Are there any that do work on Wayland?

1 Like

This is an annoyance, KColorchooser loses the ‘Pick’ button in Wayland. It really p1553D me off when I came to edit my colourscheme when fixing up Libreoffice Calc last week…

However, I now put the Plasma picker on a hidden panel up top - that works, and you can quickly right click and have it show a history of 3-4 colours when you’re working with it (then, generally I’ll reset that down to one later).

So you can pick colors and copy the codes - so now I’ll keep them in history, and maybe copy them to a list in a text file (opening with Kate and enable colour previews) - but you’re right, stuff like KColorchooser and Gpick are useless now… it’s sad.


Screenshot_20240331_143122

This is a limitation of the new Wayland graphics stack - applications are not allowed to willy-nilly interact with other stuff on the desktop. Screenshots is a thing that people need and so different Wayland compositors tried to address it in different ways - GNOME has a DBUS API that you can ask for a screenshot, KDE’s Kwin has a different D-BUS API, and two different Wayland protocols were suggested: wlr-screencopy-unstable-v1 from Sway and wlr-export-dmabuf-unstable-v1 from wlroots.

There are many screenshoting tools that work well in Wayland, some even supporting multiple protocols, and color pickers are basically “screenshot with some tiny extra functionality” so you’d expect that to not be a problem - but AFAIK no GUI color picker implements any of these protocols and therefor they are all dead. There’s a Github project for a script called wl-color-picker that uses the Sway unstable protocol - that doesn’t work in Plasma, so I won’t bother linking it.

But there is hope - the designers of the KWin DBUS API for screenshots apparently did consider that color picking is something useful and very adjacent to screenshots - so they have support for that in the DBUS API, and you can trigger it manually. I recommend using the command line terminal, as using it through the qdbusviewer is less useful, but here’s a bash script for you to do the whole thing:

#!/bin/bash

function pick() {
        qdbus --literal org.kde.KWin.ScreenShot2 /ColorPicker org.kde.kwin.ColorPicker.pick | sed 's/^[^0-9]*//;s/[^0-9]*$//;'
}

function to_argb() {
        printf "%x" "$1"
}

kdialog --inputbox "Your color" "#$(to_argb $(pick))"

To use it, create a file named wl-color-picker (or anything else that tickles your fancy) somewhere that makes sense (I use ~/.local/bin), put the code in it and then change its permissions by giving it “execute” permission. Then you can double click it, create an application menu launcher for it, or whatnot. Whenever you run it, it will show a color picker (this is driver completely by KWin and I have no control over it) and when you click you will get a dialog box with your ARGB color.

It uses kdialog which you should install to get the popup window at the end.

https://bugs.kde.org/show_bug.cgi?id=479406

1 Like

https://bugsfiles.kde.org/attachment.cgi?id=167815

KColorSchemeEditor exists in a screenshot for the bug, but I cannot find that in the package manager… it’s the dialog that opens when you edit Color schemes, and it works…