Color Palette

Forget about ‘list-colors-display’! If you really want to look up a color by name or RGB components, then you want to see what it looks like in context – either in the context of a palette of all colors or in the context of your work, as text foreground or background. And most of the time you don’t want to deal with color names at all.

(Most of the time you don’t want to deal with face names either – see FaceMenuPlus for point-and-click access to faces and their colors, including access to the color palette described here.)

Library palette.el provides a general color palette that you can use to examine color properties or choose colors. You can input colors using color names, RGB components (red, green, blue), or HSV components (hue, saturation, value). Completion is available for color names. If you also use Icicles, then you can match any part(s) of the color name, and you can browse multiple colors by name successively – ‘c’ is then a multi-command (see Icicles - Multi-Commands).

Note: Library palette.el is only for use with a window manager. Do not try to use it with ‘emacs -nw’.

Hue means tint; saturation means color purity or intenseness (opposite of grayness); and value means brightness. Saturation=0 is grayscale; saturation=1 is pure color (no gray). Value=0 is black (no light); value=1 is as bright as possible (100% color). Hue 0.0 and hue 1.0 are the same: pure red. The hue x saturation palette shows this discontinuity. Move the cursor horizontally near the right side of this palette and you will see the hue value jump between 0.0 and 1.0 at a certain point.

You can navigate the HSV and RGB color spaces interactively. Hit `?’ at any time to examine the color under the cursor – the HSV and RGB components are displayed in the echo area. Click ‘mouse-1’ or move the text cursor to examine other colors.

If you also use library misc-cmds.el then you can use `C-?’ (command ‘palette-list-colors-nearest’) in the palette to list (show) the colors that are nearest a given color. By default, the given color is the color under the cursor. But with a prefix argument you are prompted for the color.

Use `‘RET’ or ‘mouse-2’ to choose the color under the cursor, making it the “current color”. The current color is displayed with a large swatch to the right of the hue x saturation palette. You can also hold the Shift key down while you move the cursor, to continually update the current color. You can hit `~’ to set the current color to its complement. (Again, `?’ shows you the components of that complement color.) Use ‘C-h m’ for more info. A popup menu of the palette commands is available on ‘mouse-3’.

Once you find a color you like, you can use its RGB string anywhere in Emacs as the color definition of a face or a frame. Its RGB string is the value of ‘palette-current-color’.

This palette is similar to many that exist outside Emacs – a good example is the palette available in Microsoft Word (A > More Colors > Custom). You will need Emacs 22 or later for palette.el to be useful, because it makes heavy use of Emacs faces, and the display engine of Emacs 20 and 21 is not up to the task. Have fun!

Here is a screenshot of the palette frame:


And here is a screenshot of the palette ‘mouse-3’ menu, showing some of the key bindings for Color Palette mode:


The palette should appear as shown above, in its own, small frame. If the palette appears much larger than what you see above, or if it looks weird, then your font is probably too large. In that case, customize option ‘palette-font’ – see it for more information. More generally, you can change the size of the palette by simply changing the size of its font: ‘palette-font’. Here is a screenshot with ‘palette-font’ = "-outline-Courier-normal-i-normal-normal-3-37-96-96-c-*-iso8859-1" instead of the default size-5 font:


Eye Dropper

You can at any time, from any Emacs window, pick up the foreground or background color at the current cursor position (point), setting variable ‘palette-current-color’ to it. Use commands ‘eyedropper-foreground’ and ‘eyedropper-background’ to do this. You can then set any Emacs face or frame color using the value of ‘palette-current-color’. With a prefix argument (‘C-u’), these commands also display the palette.

Point and Click: Palette for Any Face You See

Again (it’s worth repeating), if you load library facemenu+.el, then you can access the color palette for any face you see used in an Emacs buffer, just by pointing to it (‘C-mouse-2’) – the Text Properties popup menu is enhanced to give you access to the palette and the eyedropper. See FaceMenuPlus.

Use with Crosshairs

I recommend that you also use library crosshairs.el (see Crosshair Highlighting), so that you can turn on ‘crosshairs-mode’ (using the suggested key binding of `C-+’). That makes the location of the cursor much more visible, which really helps since it is necessarily very small for the palette.


Use with Icicles

If you use the color palette with Icicles, then ‘c’ is bound in the palette to an Icicles multi-command that lets you choose colors by name. After you hit ‘c’, you can hit ‘TAB’ or ‘S-TAB’ to use Icicles completion. During completion, you can use ‘C-next’, ‘C-prior’, ‘C-down’, ‘C-up’, and ‘C-RET’ to change the current color to different colors, by name, successively. This lets you browse colors by name, seeing what they look like immediately. See Icicles - Multi-Commands for more on multi-commands.

Do Re Mi

DoReMi provides an alternative to the color palette for editing Emacs colors. It lets you incrementally adjust face and frame properties, including colors, using the arrow keys or a mouse wheel. The color changes are applied instantly to the face(s) or frames, so you see the result as you make the changes.

Emacs-Lisp Programmers

You can call function ‘palette’ from your EmacsLisp code to open the palette for users to define a color that your code needs. Function ‘palette’ takes as optional argument the initial color (swatch) to display. You can pick up the last value of the current color (‘palette-current-color’) automatically when the user exits the palette, by setting ‘palette-exit-hook’. For an example of how this is done, see command ‘facemenup-palette-face-fg-at-mouse’ in library facemenu+.el.


Issues with palette.el

Error: "X windows are not in use or not initialized" when running with "emacs -nw"

The error says the truth. However, palette should not stop Emacs from loading, but rather raise the error when palette is actually invoked.

Emacs 22.2. 17-10-2008. Stacktrace:

Debugger entered--Lisp error: (error "X windows are not in use or not initialized")                                            
  x-list-fonts("-*-Courier-*-*-*-*-5-*-*-*-*-*-iso8859-1" nil nil 1)                                                           
  (car (x-list-fonts "-*-Courier-*-*-*-*-5-*-*-*-*-*-iso8859-1" nil nil 1))                                                    
  (or (car (x-list-fonts "-*-Courier-*-*-*-*-5-*-*-*-*-*-iso8859-1" nil nil 1)) (car (x-list-fonts "-*-fixed-*-*-*-*-5-*-*-*-*$
  eval((or (car (x-list-fonts "-*-Courier-*-*-*-*-5-*-*-*-*-*-iso8859-1" nil nil 1)) (car (x-list-fonts "-*-fixed-*-*-*-*-5-*-$
  custom-initialize-reset(palette-font (or (car (x-list-fonts "-*-Courier-*-*-*-*-5-*-*-*-*-*-iso8859-1" nil nil 1)) (car (x-l$
  custom-declare-variable(palette-font (or (car (x-list-fonts "-*-Courier-*-*-*-*-5-*-*-*-*-*-iso8859-1" nil nil 1)) (car (x-l$
  eval-buffer(#<buffer  *load*<2>> nil "/home/dc/.emacs.d/palette/palette.el" nil t)  ; Reading at buffer position 3760        

OK, I’ve tried to take care of that. – DrewAdams


I also use you color palette, it’s a good tool to select color.But on my ubuntu 8.04 system, it took a little long time to execute M-x palette and palette-pick-background-at-point, when execute palette-pick-background-at-point, color palette first change to black, then display color palette, that behavior like M-x palette, on my xp system, the time is short than on ubuntu, but hardware of my ubuntu system is better than my xp system. – ahei

Yes, I’m afraid the performance is what it is. The problem is that Emacs faces are very slow – they were simply not designed to be used this way. As soon as you have a lot of faces, Emacs slows to a crawl.

I created the palette partly as a proof-of-concept. I specifically wanted to use faces this way. A much more performant solution would be to just (a) make a screen-capture image of the palette body, and then use that, instead of zillions of tiny space characters, each in a different face. I haven’t bothered to do that. Someone else might want to.

For my own use, it’s OK that the palette is slow – I just go into it, use it a bit, and then quit it. Once I’ve quit, Emacs is no longer slow. I guess what I’m saying is that if the palette is too slow for your needs, then just don’t use it. Or better yet, recode it to use an image etc. – that would be a useful improvement. To do that, you will need to make a careful map from image locations to the corresponding color info, since the info won’t be contained in faces. – DrewAdams

Vestigial Buffers

When I close color palette’s window, the buffer “Palette (Hue x Saturation)”, “Brightness”, “Current/Original” also exist, can you kill them? I think user is not need them after they close color palette’s window. – ahei

How are you closing the window? You should use ‘q’ or ‘x’. If you do that, all of the palette buffers are killed. Let me know if that doesn’t work for you. – DrewAdams

I close color palette just use mouse to click the system close button which at right top of color palette’s frame. – ahei

That action doesn’t go through Emacs. Use ‘q’ or ‘x’. – DrewAdams

You can add palette-quit to delete-frame-hook when major-mode is palette-mode. – ahei

Sorry, I don’t want to add to ‘delete-frame-hook’. You can do that easily enough as a user, if you like. I recommend you use ‘q’ or ‘x’ instead (or the equivalent menu items Quit or Exit, if you really want to use the mouse). – DrewAdams

can you tell me the reason you don’t want to add palette-quit to ‘delete-frame-hook’? do that is easy for me, but I think a good tool shoud prevent user to make mistake, so I suggest you do that. – ahei

It’s not a question of a user mistake. Deleting a window or frame is deleting a window or frame; it is not killing a buffer. IOW, it is about user intention – what is a mistake to you is intended by other users. Individual users can easily add a hook action to combine the behaviors, but they are logically distinct. You have plenty of ways to delete the palette windows, frame, and buffers all at once, both using the keyboard and the mouse. If you want more ways, you can easily add them. – DrewAdams


When ‘hl-line-mode’ is active, I use command ‘facemenup-palette-face-fg-at-point’, but it get face color of hl-line-face, when I select one color and save it, then exit (Update Action), It also change face color of hl-line-face. – ahei

That’s the expected behavior. But it doesn’t “also” change the ‘hl-line’ face; it only changes that face. That is the face that you edited.

When you use ‘facemenup-palette-face-fg-at-point’ you are asking to pick up the foreground color of the face at point, which is face ‘hl-line’ in your case. And ‘facemenup-palette-face-fg-at-point’ has as part of its behavior – if you exit with ‘x’ – to update the face at point to the new color that results from your editing with the palette.

This is the difference between exiting the palette using ‘x’ and using ‘q’. If you look at the Palette menu you’ll see that these exit commands are labeled Exit (Update Action) and Quit (Cancel), respectively. If you use ‘x’ then you are saying that you want to save the new color that resulted from your editing using the palette. IOW, ‘x’ really does edit the face; ‘q’ does not (it cancels editing). – DrewAdams

My meaning is: when hl-line mode is no and user call ‘facemenup-palette-face-fg-at-point’, and then edit color on color palette and use ‘x’ to update action, they do want to update color which cursor point to, not hl-line face, what do you think about it? – ahei

When hl-line mode is on, the face under the cursor is face ‘hl-line’. That’s the point. If you want some other face, then turn off hl-line mode temporarily. The code just uses the first face at point, if there is more than one. I don’t want to try special-casing things for unrelated modes (e.g. hl-line mode), picking the first face unless it is ‘hl-line’ or the moon is full etc. You can always use ‘facemenup-palette-face-fg-at-mouse’ instead - IOW, just click the place you want to pick up a face. – DrewAdams

1. I think there have users use hl-line and your facemenup together, can you add another command to pick face at point which is not hl-line-face, e.g. palette-face-at-point-no-hl-line.

2. How do I use ‘facemenup-palette-face-fg-at-mouse’.

3. Why color palette frame on my winxp system is so narrow?

4. How do I update action(x) but not need to close palette frame, then I can update face selection immediately, if I’m dissatisfied the face I selected, I can select other face again but not need close palette, and then select color use palette more conveniently.

5. Why I cannot see your reply in “Recent Changes” page some time? – ahei

1. I don’t want to add a command specially for that; sorry. You can write such a command if you really need it. Otherwise, turn off hl-line mode temporarily or use ‘facemenup-palette-face-fg-at-mouse’. Consider binding a key to ‘hl-line-mode’ or ‘global-hl-line-mode’. (Personally, I bind `C-+’ to `crosshairs-mode'.)

2. ‘C-mouse-2’ > Palette - Edit Face Foreground ‘RET’ Change the color using the palette. Use ‘x’ to save the edited color. The doc string says:

  Use palette to edit foreground of face under the mouse pointer.
  To change this face: edit the color in the palette, then save it
  (`C-s'), and exit the palette using `x'.
  To quit the palette without effecting any change on the face, use `q'.

3. Dunno. I use Windows XP and it looks exactly like the screenshots on this page. See the explanation above about the size. The palette “pixels” are in fact space chars (‘SPC’). Use a fixed-width font. Choose a font that gives the size you want. You might have to experiment a bit.

4. You can use `facemenu-face-(bg|fg)-restore’ to restore the last face color. They are on the same Text Properties menu (‘C-mouse-2’), items Restore Last Foreground etc. Or use `facemenup-paste-to-face-(bg|fg)-at-mouse’ after ‘RET’ or ‘mouse-2’. They are items Eyedropper - Paste to Face Foreground etc.

5. Dunno. Perhaps I made a minor edit and you don’t show minor edits? Dunno. – DrewAdams

1. About question 4 I mentioned above, I must use “Exit(Update Action) x”, but this will close palette frame, my meaning is: how do I update action but not need to close palette frame?

2. I suggest you:

 You can add palette-quit to delete-frame-hook when major-mode is palette-mode.

after your reply:

 That action doesn’t go through Emacs. Use ‘q’ or ‘x’. – DrewAdams

have you seen that?

3. and, can you understand my explanation about my suggestion for your DoReMi? – ahei

new1. I answered your #4 already: Don’t use ‘x’. Don’t close the palette. Use `facemenup-paste-to-face-(bg|fg)-at-mouse’ after ‘RET’ or ‘mouse-2’ in the palette. Or if you do close the palette and you want to restore the color you had, then use `facemenu-face-(bg|fg)-restore’.

new2. See above.

new3. If you are asking whether I understand your last reply on page DoReMi, the answer is yes, I believe so. I’ll try to come up with something, but I don’t think this is a very useful use case. – DrewAdams

I use M-x facemenup-paste-to-face-fg-at-mouse after ‘RET’, but I get one error message “execute-extended-command: facemenup-paste-to-face-fg-at-mouse must be bound to an event with parameters”, and I use laptop, there no ‘mouse-2’. and my meaning is not restore the color I had, is how to update the face I selected and not need to close palette. – ahei

You asked “How do I use ‘facemenup-palette-face-fg-at-mouse’.” But you don’t have a mouse? Note: If you have a mouse but no ‘mouse-2’, you can use ‘mouse-1’ and ‘mouse-3’ together to paste.

Anyway, if you’re not using the mouse, then use ‘facemenup-paste-to-face-fg-at-point’, not ‘-at-mouse’. This command is on the Text Properties menus (both under the menu bar Edit menu and on ‘C-mouse-2’).

The palette is just a bunch of faces. You can copy the foreground or background of any face, anywhere – including in the palette, and then paste it to the foreground or background of any other face. Note: you can paste a color that you copied from a background (e.g. in the palette, which doesn’t even use the foreground) to another face’s foreground. And vice versa.

And whenever you change the current color in the palette, the new current color is automatically copied. So all you need to do is paste it. So, just ‘RET’ in the palette, then use ‘facemenup-paste-to-face-fg-at-point’ with point on a face anywhere.

And you have ‘facemenup-face-fg-restore’ (likewise ‘-bg-’), which is Restore Last Foreground on the menu, to undo the paste.

Note: I just fixed a bug in `facemenup-paste-to-face-(bg|fg)-at-point’ that was preventing pasting a background to foreground and vice versa. And I fixed another bug in the palette. Be sure to get the latest palette.el and facemenu+.el. – DrewAdams

I use pc when work, and I use laptop at home, there have only mouse-1 and mouse-3 on my laptop, no mouse-2.

I use ‘facemenup-palette-face-fg-at-mouse’ success, but I don’t know why it need a bit long time to finish execute ‘facemenup-palette-face-fg-at-mouse’ command.

Just now, I try latest version of palette and facemenu+, ‘facemenup-paste-to-face-fg-at-point’ can work, but It also need a bit long time to finish execute ‘facemenup-paste-to-face-fg-at-point’, and I can not put cursor on palette when execute ‘facemenup-paste-to-face-fg-at-point’, how do I paste face but not need to leave palette, I think when users choose face, they will try many faces util choose one satisfying face, so if they paste face everty time, they must leave palette, they will fell boring, how do you think about it? – ahei

1. FYI – As I said, you should be able to click ‘mouse-1’ and ‘mouse-3’ together, to get the effect of ‘mouse-2’. That can take a little practice, admittedly, and it’s not as handy as using a real mouse. But it can be useful. YMMV.

2. The time it takes is what it takes to update a face. Emacs faces are slow. Each frame is updated; face inheritance is checked, etc.

3. It’s a reasonable request to be able to have palette edits reflected immediately in a face change. So I’ve implemented that.

However, in that case, there is no way to cancel the face change using ‘q’ in the palette – you will need to restore the previous color instead (e.g. ‘facemenup-face-fg-restore’). So I added an option, ‘facemenup-palette-update-while-editing-flag’, to let users choose the behavior they prefer. For the moment, the new behavior is the default. HTH. – DrewAdams

1. For your 2: but why it’s so fast to update face when I use doremi-bg-color-name+?

2. For you 3: I provide a way: ‘q’ to cancel the face updated, and ‘x’ to update action users did, this way is same as ColorPalette did, also same as mostly modal dialog do. HTH. 😊 – ahei

1. Dunno; you tell me.

2. There is nothing modal about this. The palette is separate. Each edit there causes the face to be changed, as you requested. When function ‘palette’ is called, all that does is open the palette – the facemenu command does not in any way wait until you finish editing with the palette. You can use the palette as long as you like – nothing is waiting on the palette to be closed.

If this is not good enough for you, please use an alternative, if you can find one – or roll your own. – DrewAdams

1.For your 1: Is it also slow like using facemenup-paste-to-face-fg-at-point when you use doremi-bg-color-name+ ?

2. When users choose one satisfying face, they will close palette, I think mostly users will do this, not leave palette opened and continue working i emacs, so palette frame is like modal dialog, and so, I think you can use ‘q’ to cancel the face updated, and ‘x’ to update action users did, how do you think about it? – ahei

1. I have no idea. You tell me.

2. No, not the way it is designed and implemented. As I said, calling function ‘palette’ simply displays the palette – function ‘palette’ returns immediately; nothing waits on it. As far as palette is concerned, you are simply changing colors there. You asked that each color change there also effect a face change. Palette knows nothing about that – it does not know or care whether a face is involved, what face, etc. All it does is call a function it is passed – it has no idea what that function is or what it does. The function passed in this case changes the face color.

To recover the original color, before editing, just choose the restore menu item or enter the restore command. If that’s too much trouble, then customize the option to nil, and return to the previous behavior before your enhancement request. Then ‘q’ will cancel the color change by preventing it from ever being copied from the palette to the face.

As I said, this is the design. If you want a different design, feel free to create your own. – DrewAdams

My meaning is: Is it also slow like using facemenup-paste-to-face-fg-at-point when you use doremi-bg-color-name+ on your computer? – ahei

If I have the palette open at the same time, yes; otherwise, no. As I said, Emacs is slow when there are lots of faces. And the palette uses a separate face for each bit of color you see – about 11500 faces for the hue x saturation palette alone. – DrewAdams

If I used facemenup-palette-face-fg-at-point, then I close palette, and then I use ‘M-x palette’, now, when I type “RET” on palette, it change face which be selected I used facemenup-palette-face-fg-at-point. – ahei

Thx. Should be OK now. – DrewAdams

1. I disable blink-cursor-mode, but when I execute M-x palette, it enable blink-cursor-mode.

2. when I M-x describe-function read-face-name, I get message “‘read-face-name’ is an alias for ‘old-read-face-name’ find-function-search-for-symbol: Don’t know where ‘old-read-face-name’ is defined”, how do I fix this problem?

3. I open palette use M-x palette and then close it with no operation, but It change hl-line-face, my hl-line-face not set foreground color, I see facemenup-palette-face-fg-at-point code,

(add-hook 'palette-exit-hook
                `(lambda () (set-face-foreground ',face palette-current-color)))

It will execute when I use ‘x’ to exit palette. – ahei

1. Yes, this is a general problem. I’ve tried to fix it with a workaround; please try the latest. The problem is that the palette needs a blinking cursor, since the cursor is so tiny, but ‘blink-cursor-mode’ is a global (minor) mode.

2. ‘old-read-face-name’ is what ‘read-face-name’ was before Icicles was loaded. It is probably the vanilla Emacs definition of ‘read-face-name’, unless you first loaded some library that advises that function. ‘old-read-face-name’ is defined in icicles-fn.el. Icicles restores that definition when you quit Icicle mode. (This has nothing to do with palette.el.)

3. No idea what you’re saying. Sounds like you might be repeating a previous remark about ‘hl-line-mode’, to which I already responded.

And again, you must always quit the palette using ‘palette-quit’ or ‘palette-exit’. Especially now that I’ve added the actions you wanted and an attempt to restore your preferred ‘blink-cursor-mode’ value (off). – DrewAdams

can you add a command which copy current color on palette (palette-current-color), if users select a satisfying color, they may need add it to those dot emacs. – ahei

You mention ‘palette-current-color’ yourself. That variable already has the current color as its value – just use ‘C-h v’ to see it. IOW, the current color has already been copied for you, and is always available as the value of that variable.

Beyond that, copying a color is what ‘mouse-2’, ‘RET’, `~’, ‘c’, ‘M-h’, ‘M-r’, Shift plus the arrow keys, ‘r’, ‘g’, ‘b’, ‘h’, ‘s’, ‘v’, ‘R’, and ‘H’ all do. Those and other commands copy a color to variables ‘palette-last-picked-color’, ‘palette-picked-background’, ‘palette-picked-foreground’, ‘palette-last-color’, and ‘palette-current-color’. The latter two variables will pretty much always give you the current color. This is all explained in the palette.el commentary and the doc strings of those commands and variables. You can also check the code for details. – DrewAdams

which variable that same as palette-current-color store current color when I use doremi? – ahei

None. Do Re Mi is not the same as the palette. However, if you’re looking for a variable that stores the previous color, before the Do Re Mi changes you make, see ‘doremi-last-face-value’ and ‘doremi-last-frame-color’. For a frame background/foreground change, the current color is available using function ‘frame-parameters’. For a face background/foreground change, the current color is available using functions ‘face-background’ and ‘face-foreground’. – DrewAdams

About problem of read-face-name,


emacs -q
add path to load path
(require 'icicles)
(require 'gud)

C-h f read-face-name:
read-face-name is an alias for `old-read-face-name' in `icicles-mode.el'.


emacs -q
add path to load path
(require 'icicles)
echo "(require 'gud)" > a.el
put a.el to load path
(load "a")

C-h f read-face-name:
read-face-name is an alias for `old-read-face-name' in `a.el'.

but old-read-face-name is not in a.el, so I can not location code of read-face-name. – ahei

1. This has nothing to do with ColorPalette.

2. File an Emacs bug, if you like. Your complaint is for ‘describe-function’ – it is responsible for the incorrect information that the alias is defined in a.el. – DrewAdams

“it is responsible for the incorrect information that the alias is defined in a.el.”

what do you mean? file a.el only contain one statement: (require ‘gud) – ahei

What do I mean? I mean that it is the output of vanilla Emacs function ‘describe-function’ that you are complaining is incorrect. So file an Emacs bug about that. That has nothing to do with Icicles, and even less than nothing to do with ColorPalette. – DrewAdams

Number of RGB hex digits

Hi Drew,

Thanks for the package. It’s great, except that I find it difficult to use for css/html development.

First, apparently there is no way to insert the current color into the kill ring. When I am editing a css file I might need hundreds of values. Now I am just going to message buffer to cut form there. Would be nice to rebind C-w to insert the color under the point into a kill ring.

Second 12 digit RGB hex is not standard, browsers don’t support it. I always have to manually remove 6 digits, pretty annoying. Can I somehow configure ColorPalette to output 6 digit hex?

And finally, because there are so many colors, my emacs is getting really slow when pallet is open. Is it possible to reduce the number of colors?

Many thanks. – spinuvit

In reverse order:

1. Yes, palette.el slows Emacs down considerably. There’s nothing I can do about that, given the way I chose to implement it, which uses hundreds of faces — Emacs is just not designed to handle lots of faces displayed at the same time.

An alternative, simpler in many ways but not quite as feature-full, would be to use an image and map from its coordinates. I won’t be implementing that, but it would be useful and maybe someone else will. I like what the palette does, but I do realize that one needs a powerful machine to make it not slow things down too much.

2. You can use any number of RGB digits, as long as it is a multiple of 3. The palette uses as many as it can get from user input and that doesn’t overload an Emacs integer, so that it can be more precise.

3. However, I’ve just added a user option, ‘palette-hex-rgb-digits’, which will limit the number of hex digits in messages and some return values. Some commands are also used internally, so they still return the full RGB value, i.e., ignoring ‘palette-hex-rgb-digits’. Let me know if this option gives you what you want in this regard.

4. The current color is always in variable ‘palette-current-color’ (but the variable value does not respect ‘palette-hex-rgb-digits’). There are other variables that hold foreground and background colors that you have picked. I’ve just added a command, ‘palette-current-rgb-to-kill-ring’, to copy the current color to the kill ring, respecting ‘palette-hex-rgb-digits’. It is bound to ‘M-w’ in the palette.

You will need to download hexrgb.el and palette.el anew, to pick up these changes.

Thx – DrewAdams

That’s great. Thanks for the fast feedback. But unfortunately I cannot make the ‘palette-curren-rgb-to-kill-ring’ to work. It seems to always kill the original color instead of the current one.

[edit: sorry I was confused, it works great, thanks].

Also a small improvement if possible, can ‘M-w’ also display a message, “Copied rgb #xxxxxx”?

I also noticed that the palette.el doesn’t play nicely with rainbow-mode. If I call pallete, select ‘*mouse-2 background*’ and click on a region colored by ranbow mode, I am getting the underlying background and not the rainbow color. I am not sure why, but just a guess, is rainbow using overlays and palette is not taking overlays into account?

Thanks. – spinuvit

OK, I added a message. Makes sense.

Yes, that’s likely the reason wrt rainbow mode (although I haven’t checked). The palette.el functions deal only with text properties, not overlay properties. The code could be changed to take overlays into account as well, but I’m not sure that’s a good idea.

When there are both overlays and text properties for a given position the code needs a set of rules for which to pick up, or needs to interact with the user to get the user choice. Things are already complicated enough when there are multiple faces at a given position. I’m guessing that users would be confused if things were made more complicated by dealing with overlays as well.

I don’t have a strong opinion about that. But I’m not eager to modify this immediately either. I have other things to do… If you have a strong use case, let me know the arguments and I’ll consider looking into it.

Thx – DrewAdams

Providing feature `eyedropper'

Should palette.el really provide eyedropper? – JonasBernoulli

Yes, I think so. – DrewAdams

Lisp:palette.el, Lisp:facemenu+.el

CategoryDisplay CategoryFrames CategoryFaces CategoryCustomize tt and