Subject: bug#15977: 24.3.50; enhancement request: `sample' for Customize colors should show fg & bg

From: Drew Adams <[email-masked]>
Date: Wed, 14 Aug 2019 21:33:22 -0700 (PDT)

> I'm not quite sure what you're referring to here -- do you have a
> recipe for how to show Customize colours?

emacs -Q

(defcustom foo "Red"
  "Some foo"
  :type 'color
  :group 'convenience)

M-x customize-option foo

You see this:

Hide Foo: Red         Choose   (sample)
    State : STANDARD.
   Some foo
Groups: Convenience

This uses the `color' widget, defined in `wid-edit.el' as follows:

(define-widget 'color 'editable-field
  "Choose a color name (with sample)."
  :format "%{%t%}: %v (%{sample%})\n"
  :value-create 'widget-color-value-create
  :size 10
  :tag "Color"
  :value "black"
  :completions (or facemenu-color-alist (defined-colors))
  :sample-face-get 'widget-color-sample-face-get
  :notify 'widget-color-notify
  :action 'widget-color-action)

In Customize The text "sample" (in parentheses) shows you
what the color looks like when used as a foreground (face
attribute).  It does not show you what the color looks as
a background (face attribute).

This enhancement request asks that the color be shown as
both foreground and background.  For example, instead of
a single "sample" that shows only foreground appearance,
show both "foreground" and "background" text, with the
color used as foreground and background, respectively.

Or, as the bug report suggested, show just the text
"sample", but show half of it as foreground and half of
it as background.

That's all.