Subject: Re: bug#46493: [feature/pgtk] Low contrast region face

From: Lars Ingebrigtsen <[email-masked]>
Date: Fri, 17 Jun 2022 15:41:02 +0200

Yuuki Harano <[email-masked]> writes:

> This issue is not pgtk-specific.
>
> If we want another color for bg on pgtk, we can change this face definition as follows:

The proposed patch was:

diff --git a/lisp/faces.el b/lisp/faces.el
index d92569e7cd..de1ca095aa 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -2502,7 +2502,9 @@ highlight
 (defface region
   '((((class color) (min-colors 88) (background dark))
      :background "blue3" :extend t)
-    (((class color) (min-colors 88) (background light) (type gtk))
+     (((class color) (min-colors 88) (background light) (type pgtk))
+     :background "lightgoldenrod2" :extend t)
+     (((class color) (min-colors 88) (background light) (type gtk))
      :distant-foreground "gtk_selection_fg_color"
      :background "gtk_selection_bg_color" :extend t)
     (((class color) (min-colors 88) (background light) (type ns))

But...  The gtk_selection_fg_color colour is different under gtk, but not
pgtk -- that's the problem.

Poking at this, it seems the colours we get out of GTK are:

gtk_selection_bg_color 0.964706 0.960784 0.956863

Which is a very, very light colour, which is apparently calculated
correctly in this branch here:

#ifndef HAVE_PGTK
  sprintf (buf, "rgb:%04x/%04x/%04x", r, g, b);
  success_p = x_parse_color (f, buf, color) != 0;
#else
  sprintf (buf, "#%04x%04x%04x", r, g, b);
  success_p = pgtk_parse_color (f, buf, color) != 0;
#endif

But with the non-pgtk branch we get a very dark colour.  And when taking
this into account:

      /* FIXME: Retrieving the background color is deprecated in
	 GTK+ 3.16.  New versions of GTK+ don't use the concept of a
	 single background color any more, so we shouldn't query for
	 it.  */
      gtk_style_context_get (gsty, state,
			     GTK_STYLE_PROPERTY_BACKGROUND_COLOR, &c,
			     NULL);

I think we should just remove all of this code and use the same colours
in (p)GTK Emacsen as in non.

Any other opinions?

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