How to find out what color I gave to xsetroot?
Solution 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.
Solution 2
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.
Solution 3
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
Related videos on Youtube
DarenW
Updated on September 17, 2022Comments
-
DarenW over 1 year
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?
-
geekosaur about 13 yearsI 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, thenXGetPixel()
to read the color value out of it.
-
-
DarenW about 13 yearsIt took a while to find it. Now I have xcolorsel, but it won't run.
-
DarenW about 13 yearsOTOH, 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.
-
J. Taylor about 13 yearsI'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 ...)
-
DarenW about 13 yearsAh, 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.
-
J. Taylor about 13 yearsI 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