Color Picker For Ubuntu 19.10 (and later releases as well)

EDIT: I use X11 now and I have no problem.

I’ve seen many apps posted here, but right now in my laptop with 19.10 none of them work.

I’ve tried Agave, Gpick, and Grabc .

They all give back the color black regardless of where I put the cursor on #000000

Asked By: igorgue


Here is a workaround.

Open your image, a screenshot you made or a web page with Firefox.


In Firefox go to :
Tools > Web Developer > Eyedropper

Left click on the color you want.
It’s copied in the clipboard.

For example :
Hex: #497FC1

Answered By: Gounou

Here is the X11 native solution that

  • doesn’t require any external packages like Agave, Gpick, or Grabc etc.
  • and it doesn’t limit to web pages (like the previous answer) either

Just run xmag. From its man page:

  • The xmag program allows you to magnify portions of an X screen.
  • The area can be dragged out to the desired size by pressing Button 2.
  • Once a region has been selected, a window is popped up showing a blown up version of the region in which each pixel in the source image is represented by a small square of the same color.
  • "Pressing Button1 in the enlargement window shows the position and RGB value of the pixel under the pointer until the button is released" — this, is the X11 native solution for Color Picker.
Answered By: xpt

Works in Wayland and X11

zenity --color-selection

Answered By: Porcupine

IMHO it is not very efficient to open Firefox to pick colors, at least I wouldn’t do that, especially because you can implement Ubuntu native tricks like @Porcupine answer, which I’d like to expand, in two separate ways.

CLI command

Indeed you could open BASH and type a command to get the color selection tool with zenity (works in Wayland and X11 and, on Ubuntu 22.04, requires no additional libraries):

zenity --color-selection

you can even automatically copy the output (which is an RGB color) with the following command, that can be conveniently set as an alias:

zenity --color-selection | xsel --clipboard

But if you, like me, find this a bit painful, read on.

Keyboard shortcut + HEX output

If you want to take stuff to the next level, you can set the above command to be called via keyboard shortcut. To do that:

  • re-write the above command as a function
  • bonus: append some functionality to convert the RGB output to HEX (which is what I need for instance in React Native and could be useful to others as well)
    • e.g. convert rgb(255,255,255) to #ffffff
  • encapsulate it into a file

function pick-hex() {
  # Pick a color and return it into the clipboard as HEX, not RGB

  # Use Zenity to select an RGB color
  color=$(zenity --color-selection)

  # Remove the "rgb(" prefix and ")" suffix

  # Split the color into individual RGB values
  IFS=',' read -r red green blue <<< "$color"

  # Trim leading spaces
  red=$(echo "$red" | xargs)
  green=$(echo "$green" | xargs)
  blue=$(echo "$blue" | xargs)

  # Convert RGB to hexadecimal
  red_hex=$(printf "%02X" "$red")
  green_hex=$(printf "%02X" "$green")
  blue_hex=$(printf "%02X" "$blue")

  # Combine the RGB values to form the hexadecimal color

  # Copy the color to the clipboard for use in other applications
  echo -n "$hex_color" | xsel --clipboard


Once the above is in place, setup a keyboard shortcut for this script in Ubuntu:

  • go to"Keyboard Shortcuts"
  • add a new custom shortcut and click the "+" or "Add" button.
  • in the command field, enter the path to your script (e.g. /path/to/
  • assign a custom key combination to the shortcut e.g. I like shiftaltc

and you end up with a legit color picking tool called via keyboard from anywhere in Ubuntu.

Answered By: alfx
Categories: Answers Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.