unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#15977: 24.3.50; enhancement request: `sample' for Customize colors should show fg & bg
@ 2013-11-25 23:09 Drew Adams
  2019-08-15  2:35 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 8+ messages in thread
From: Drew Adams @ 2013-11-25 23:09 UTC (permalink / raw)
  To: 15977

Please change `sample' for a color value in Customize so that it shows
the color both as a foreground and as a background.  E.g., show `sam' as
foreground and `ple' as background.

A color can be used for either.  This would give a less misleading idea
of the effect of the option value.

For example, consider a color value that is used only as a background.
It makes little sense to show its sample as only a foreground.



In GNU Emacs 24.3.50.1 (i686-pc-mingw32)
 of 2013-11-20 on LEG570
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
 `configure --enable-checking 'CFLAGS=-O0 -g3' CPPFLAGS=-DGLYPH_DEBUG=1'





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#15977: 24.3.50; enhancement request: `sample' for Customize colors should show fg & bg
  2013-11-25 23:09 bug#15977: 24.3.50; enhancement request: `sample' for Customize colors should show fg & bg Drew Adams
@ 2019-08-15  2:35 ` Lars Ingebrigtsen
  2019-08-15  4:33   ` Drew Adams
  0 siblings, 1 reply; 8+ messages in thread
From: Lars Ingebrigtsen @ 2019-08-15  2:35 UTC (permalink / raw)
  To: Drew Adams; +Cc: 15977

Drew Adams <drew.adams@oracle.com> writes:

> Please change `sample' for a color value in Customize so that it shows
> the color both as a foreground and as a background.  E.g., show `sam' as
> foreground and `ple' as background.
>
> A color can be used for either.  This would give a less misleading idea
> of the effect of the option value.
>
> For example, consider a color value that is used only as a background.
> It makes little sense to show its sample as only a foreground.

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

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#15977: 24.3.50; enhancement request: `sample' for Customize colors should show fg & bg
  2019-08-15  2:35 ` Lars Ingebrigtsen
@ 2019-08-15  4:33   ` Drew Adams
  2019-08-15  8:13     ` martin rudalics
                       ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Drew Adams @ 2019-08-15  4:33 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 15977

> 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.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#15977: 24.3.50; enhancement request: `sample' for Customize colors should show fg & bg
  2019-08-15  4:33   ` Drew Adams
@ 2019-08-15  8:13     ` martin rudalics
  2019-08-15 13:56       ` Drew Adams
  2019-08-15 18:51     ` Juri Linkov
  2019-08-16  1:16     ` Lars Ingebrigtsen
  2 siblings, 1 reply; 8+ messages in thread
From: martin rudalics @ 2019-08-15  8:13 UTC (permalink / raw)
  To: Drew Adams, Lars Ingebrigtsen; +Cc: 15977

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

It might be a bit non-trivial to pick a suitable foreground color for
"sample" when showing the background but it sounds like a nice idea.

martin





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#15977: 24.3.50; enhancement request: `sample' for Customize colors should show fg & bg
  2019-08-15  8:13     ` martin rudalics
@ 2019-08-15 13:56       ` Drew Adams
  0 siblings, 0 replies; 8+ messages in thread
From: Drew Adams @ 2019-08-15 13:56 UTC (permalink / raw)
  To: martin rudalics, Lars Ingebrigtsen; +Cc: 15977

>  > Or, as the bug report suggested, show just the text
>  > "sample", but show half of it as foreground and half of
>  > it as background.
> 
> It might be a bit non-trivial to pick a suitable foreground color for
> "sample" when showing the background but it sounds like a nice idea.

Even with no attempt to do anything special
(i.e., just using the frame background as the
foreground color) it would be an improvement.

And even when the text on the sample wouldn't
be legible/visible (e.g. background swatch
same as or similar to white default background)
it would be useful.

It's a _color_ sample - a simple (background)
color swatch would be OK in all circumstances.
It's just that if we can show its appearance
for both foreground and background then that's
a plus.

FWIW, in my library palette.el I have code
that optionally changes the cursor color to
make it be the complement of the color of
its current position.  Yes, that's a little
bit complicated, but it's doable.

But in the case of this enhancement request
we wouldn't really want the complement.
Probably one of the functions added to
color.el for dealing with color distance would
be usable, to get a grayscale color that
contrasts well with the background.  Just one
suggestion - but see above: just not worrying
about this at all would be fine, IMO.  All we
need is a color swatch (just background, no
text needed).





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#15977: 24.3.50; enhancement request: `sample' for Customize colors should show fg & bg
  2019-08-15  4:33   ` Drew Adams
  2019-08-15  8:13     ` martin rudalics
@ 2019-08-15 18:51     ` Juri Linkov
  2019-08-16  1:16     ` Lars Ingebrigtsen
  2 siblings, 0 replies; 8+ messages in thread
From: Juri Linkov @ 2019-08-15 18:51 UTC (permalink / raw)
  To: Drew Adams; +Cc: Lars Ingebrigtsen, 15977

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

Please don't show half of it as foreground/background.  Better to show
two complete words each with their own foreground/background.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#15977: 24.3.50; enhancement request: `sample' for Customize colors should show fg & bg
  2019-08-15  4:33   ` Drew Adams
  2019-08-15  8:13     ` martin rudalics
  2019-08-15 18:51     ` Juri Linkov
@ 2019-08-16  1:16     ` Lars Ingebrigtsen
  2022-01-26 17:08       ` Lars Ingebrigtsen
  2 siblings, 1 reply; 8+ messages in thread
From: Lars Ingebrigtsen @ 2019-08-16  1:16 UTC (permalink / raw)
  To: Drew Adams; +Cc: 15977

Drew Adams <drew.adams@oracle.com> writes:

> 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

Thanks for the recipe.  Yes, I agree with you -- it would be better if
it also showed this colour as a background (i.e., block), which would
make it easier to determine whether to use the colour.  And like Juri
says, it should probably be two samples, one as a foreground and one as
a background.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#15977: 24.3.50; enhancement request: `sample' for Customize colors should show fg & bg
  2019-08-16  1:16     ` Lars Ingebrigtsen
@ 2022-01-26 17:08       ` Lars Ingebrigtsen
  0 siblings, 0 replies; 8+ messages in thread
From: Lars Ingebrigtsen @ 2022-01-26 17:08 UTC (permalink / raw)
  To: Drew Adams; +Cc: 15977, Juri Linkov

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Thanks for the recipe.  Yes, I agree with you -- it would be better if
> it also showed this colour as a background (i.e., block), which would
> make it easier to determine whether to use the colour.  And like Juri
> says, it should probably be two samples, one as a foreground and one as
> a background.

I had a peek at this, and the sample faces come from here:

(define-widget 'color 'editable-field
  "Choose a color name (with sample)."
  :format "%{%t%}: %v (%{sample%})\n"
  :value-create 'widget-color-value-create
  :size (1+ (apply #'max 13 ; Longest RGB hex string.
                   (mapcar #'length (defined-colors))))
  :tag "Color"
  :value "black"
  :completions (defined-colors)
  :sample-face-get 'widget-color-sample-face-get

But of course, you can't have two samples in the :format, I think?
So...  you'd have to create...  er...  a sub widget?  OK, I give up.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-01-26 17:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-25 23:09 bug#15977: 24.3.50; enhancement request: `sample' for Customize colors should show fg & bg Drew Adams
2019-08-15  2:35 ` Lars Ingebrigtsen
2019-08-15  4:33   ` Drew Adams
2019-08-15  8:13     ` martin rudalics
2019-08-15 13:56       ` Drew Adams
2019-08-15 18:51     ` Juri Linkov
2019-08-16  1:16     ` Lars Ingebrigtsen
2022-01-26 17:08       ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).