5

I used xsetroot -solid "#xxxxxx" to set a background color. I like this color, but did not record the command and it's long gone from the bash shell history.

How can I find out what the color was?

1
  • 1
    I know how to do it from a program (painfully), but don't think there's a good way to get it from the shell. Short version is to use XGetImage() to grab a visible part of the root window, then XGetPixel() to read the color value out of it.
    – geekosaur
    Mar 20, 2011 at 1:39

3 Answers 3

4

Assuming it still is the color of the root window: run xcolorsel (part of the contributed X utility set; some distributions pack it separately), click the “Grab color” button, and click somewhere on your root window. The numbers you want are the ones below the color list box. Change the display format to “8 bit scalred rgb” to have something familiar.

1
  • It took a while to find it. Now I have xcolorsel, but it won't run.
    – DarenW
    Mar 20, 2011 at 2:39
1

I would just use the Color Picker tool from Gimp, which will let you click anywhere on the screen and will give you the RGB value for the color at that point.

5
  • That tool seems to be limited only to gimp's own image windows. Unless there's a secret trick to it?
    – DarenW
    Mar 20, 2011 at 2:35
  • OTOH, gimp works great on image, and that image can be a screen capture of the desktop. Problem solved. (Duh, is obvious.) Still would be nice to have a way to retrieve exactly what was given to xsetroot.
    – DarenW
    Mar 20, 2011 at 2:43
  • I'm sorry Daren -- I thought I remembered an option to select outside of Gimp with the Color Picker tool ... what I was thinking about is the picker that's in the color selection dialog (when you click to change the color for your brushes -- the dropper that's in the color selection dialog) -- that one will let you select from anywhere without having to take a screenshot. (I think I'll going to write a patch to make the color picker tool do that too though ...)
    – J. Taylor
    Mar 20, 2011 at 5:22
  • Ah, I didn't think of using the color selection dialog (from clicking on the white/black overlapping squares); tried only the eyedropper in the toolbox.
    – DarenW
    Mar 21, 2011 at 16:01
  • 1
    I asked the gimp developers why the Color Picker tool (i.e. the one in the Toolbox, rather than the picker in the color selection dialog) isn't able to grab off screen, and they explained that it's because you'd have to globally grab the mouse until the user selected a color, which is different from how all of the other tools act (i.e. none of the other tools can grab the mouse): bugzilla.gnome.org/show_bug.cgi?id=645282
    – J. Taylor
    Mar 21, 2011 at 20:25
1

Use well known color names compilation https://en.wikipedia.org/wiki/X11_color_names:

$ apt-file search rgb.txt
...
x11-common: /etc/X11/rgb.txt
...

$ less /etc/X11/rgb.txt

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .