Commit 63d0dc79 authored by Federico Tedin's avatar Federico Tedin Committed by Eli Zaretskii

Allow control on the threshold for using 'distant-foreground'

* src/xfaces.c (NEAR_SAME_COLOR_THRESHOLD): Macro deleted.
(load_face_colors): Compare against
face_near_same_color_threshold instead of
NEAR_SAME_COLOR_THRESHOLD.
(syms_of_xfaces) <face-near-same-color-threshold>: New
variable.  (Bug#34001)

* etc/NEWS: Announce the change.
parent 44b7436d
Pipeline #877 passed with stage
in 50 minutes and 57 seconds
......@@ -145,6 +145,13 @@ EMACS_SOCKET_NAME environment variable to an appropriate value.
*** When run by root, emacsclient no longer connects to non-root sockets.
(Instead you can use Tramp methods to run root commands in a non-root Emacs.)
---
** Control of the threshold for using the 'distant-foreground' color.
The threshold for color distance below which the 'distant-foreground'
color of the face will be used instead of the foreground color can now
be controlled via the new variable 'face-near-same-color-threshold'.
The default value is 30000, as the previously hard-coded threshold.
+++
** The function 'read-passwd' uses '*' as default character to hide passwords.
......
......@@ -1157,8 +1157,6 @@ load_color (struct frame *f, struct face *face, Lisp_Object name,
#ifdef HAVE_WINDOW_SYSTEM
#define NEAR_SAME_COLOR_THRESHOLD 30000
/* Load colors for face FACE which is used on frame F. Colors are
specified by slots LFACE_BACKGROUND_INDEX and LFACE_FOREGROUND_INDEX
of ATTRS. If the background color specified is not supported on F,
......@@ -1199,7 +1197,7 @@ load_face_colors (struct frame *f, struct face *face,
dfg = attrs[LFACE_DISTANT_FOREGROUND_INDEX];
if (!NILP (dfg) && !UNSPECIFIEDP (dfg)
&& color_distance (&xbg, &xfg) < NEAR_SAME_COLOR_THRESHOLD)
&& color_distance (&xbg, &xfg) < face_near_same_color_threshold)
{
if (EQ (attrs[LFACE_INVERSE_INDEX], Qt))
face->background = load_color (f, face, dfg, LFACE_BACKGROUND_INDEX);
......@@ -6799,6 +6797,17 @@ RESCALE-RATIO is a floating point number to specify how much larger
a font of 10 point, we actually use a font of 10 * RESCALE-RATIO point. */);
Vface_font_rescale_alist = Qnil;
DEFVAR_INT ("face-near-same-color-threshold", face_near_same_color_threshold,
doc: /* Threshold for using distant-foreground color instead of foreground.
The value should be an integer number providing the minimum distance
between two colors that will still qualify them to be used as foreground
and background. If the value of `color-distance', invoked with a nil
METRIC argument, for the foreground and background colors of a face is
less than this threshold, the distant-foreground color, if defined,
will be used for the face instead of the foreground color. */);
face_near_same_color_threshold = 30000;
#ifdef HAVE_WINDOW_SYSTEM
defsubr (&Sbitmap_spec_p);
defsubr (&Sx_list_fonts);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment