* [PATCH v3 0/4] Support 24-bit terminal colors.
@ 2017-02-14 15:58 Rami Ylimäki
2017-02-14 15:58 ` [PATCH v3 1/4] Remove unused terminal color pair count Rami Ylimäki
` (4 more replies)
0 siblings, 5 replies; 14+ messages in thread
From: Rami Ylimäki @ 2017-02-14 15:58 UTC (permalink / raw)
To: emacs-devel
From: Rami Ylimäki <rjy@iki.fi>
Fixed since v2:
* Replace '#if TERMINFO' with '#ifdef TERMINFO'.
* Rename custom terminfo strings from 'seta[bf]24' to 'set[bf]24',
because the 'a' in 'seta[bf]' stands for ANSI.
* Update FAQ and NEWS.
* Update commit messages to match FAQ.
Rami Ylimäki (4):
Remove unused terminal color pair count.
Support 24-bit terminal colors.
Let user turn 24-bit terminal colors on.
Update documentation regarding 24-bit TTY colors.
doc/misc/efaq.texi | 33 +++++++++++++++++++++++++++++++++
etc/NEWS | 5 +++++
lisp/term/tty-colors.el | 19 +++++++++++++++++--
lisp/term/xterm.el | 8 ++++++++
src/term.c | 20 ++++++++++++++------
src/termchar.h | 4 ----
src/tparam.h | 4 ++++
7 files changed, 81 insertions(+), 12 deletions(-)
--
2.7.4
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v3 1/4] Remove unused terminal color pair count.
2017-02-14 15:58 [PATCH v3 0/4] Support 24-bit terminal colors Rami Ylimäki
@ 2017-02-14 15:58 ` Rami Ylimäki
2017-02-14 15:58 ` [PATCH v3 2/4] Support 24-bit terminal colors Rami Ylimäki
` (3 subsequent siblings)
4 siblings, 0 replies; 14+ messages in thread
From: Rami Ylimäki @ 2017-02-14 15:58 UTC (permalink / raw)
To: emacs-devel
From: Rami Ylimäki <rjy@iki.fi>
The TN_max_pairs field is unused and would be inconvenient with direct
color modes.
* src/termchar.h (tty_display_info): Remove TN_max_pairs field
describing maximum number of terminal background/foreground color pairs.
* src/term.c (tty_default_color_capabilities, tty_setup_colors,
init_tty): Remove references to TN_max_pairs.
---
src/term.c | 6 ------
src/termchar.h | 4 ----
2 files changed, 10 deletions(-)
diff --git a/src/term.c b/src/term.c
index c067a86..b0ff9cb 100644
--- a/src/term.c
+++ b/src/term.c
@@ -2048,7 +2048,6 @@ TERMINAL does not refer to a text terminal. */)
to work around an HPUX compiler bug (?). See
http://lists.gnu.org/archive/html/emacs-devel/2007-08/msg00410.html */
static int default_max_colors;
-static int default_max_pairs;
static int default_no_color_video;
static char *default_orig_pair;
static char *default_set_foreground;
@@ -2066,7 +2065,6 @@ tty_default_color_capabilities (struct tty_display_info *tty, bool save)
dupstring (&default_set_foreground, tty->TS_set_foreground);
dupstring (&default_set_background, tty->TS_set_background);
default_max_colors = tty->TN_max_colors;
- default_max_pairs = tty->TN_max_pairs;
default_no_color_video = tty->TN_no_color_video;
}
else
@@ -2075,7 +2073,6 @@ tty_default_color_capabilities (struct tty_display_info *tty, bool save)
tty->TS_set_foreground = default_set_foreground;
tty->TS_set_background = default_set_background;
tty->TN_max_colors = default_max_colors;
- tty->TN_max_pairs = default_max_pairs;
tty->TN_no_color_video = default_no_color_video;
}
}
@@ -2095,7 +2092,6 @@ tty_setup_colors (struct tty_display_info *tty, int mode)
{
case -1: /* no colors at all */
tty->TN_max_colors = 0;
- tty->TN_max_pairs = 0;
tty->TN_no_color_video = 0;
tty->TS_set_foreground = tty->TS_set_background = tty->TS_orig_pair = NULL;
break;
@@ -2113,7 +2109,6 @@ tty_setup_colors (struct tty_display_info *tty, int mode)
tty->TS_set_background = "\033[4%dm";
#endif
tty->TN_max_colors = 8;
- tty->TN_max_pairs = 64;
tty->TN_no_color_video = 0;
break;
}
@@ -4135,7 +4130,6 @@ use the Bourne shell command 'TERM=...; export TERM' (C-shell:\n\
}
tty->TN_max_colors = tgetnum ("Co");
- tty->TN_max_pairs = tgetnum ("pa");
tty->TN_no_color_video = tgetnum ("NC");
if (tty->TN_no_color_video == -1)
diff --git a/src/termchar.h b/src/termchar.h
index e6e483e..cf061a9 100644
--- a/src/termchar.h
+++ b/src/termchar.h
@@ -149,10 +149,6 @@ struct tty_display_info
int TN_max_colors; /* "Co" -- number of colors. */
- /* "pa" -- max. number of color pairs on screen. Not handled yet.
- Could be a problem if not equal to TN_max_colors * TN_max_colors. */
- int TN_max_pairs;
-
/* "op" -- SVr4 set default pair to its original value. */
const char *TS_orig_pair;
--
2.7.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 2/4] Support 24-bit terminal colors.
2017-02-14 15:58 [PATCH v3 0/4] Support 24-bit terminal colors Rami Ylimäki
2017-02-14 15:58 ` [PATCH v3 1/4] Remove unused terminal color pair count Rami Ylimäki
@ 2017-02-14 15:58 ` Rami Ylimäki
2017-02-14 15:58 ` [PATCH v3 3/4] Let user turn 24-bit terminal colors on Rami Ylimäki
` (2 subsequent siblings)
4 siblings, 0 replies; 14+ messages in thread
From: Rami Ylimäki @ 2017-02-14 15:58 UTC (permalink / raw)
To: emacs-devel
From: Rami Ylimäki <rjy@iki.fi>
Assume that number of terminal colors has been set to 16777216 if
terminal supports direct color mode. Detection of 24-bit color support
is added in next commit.
* lisp/term/tty-colors.el (tty-color-define): Convert color palette
index to pixel value on 16.7M color terminals.
(tty-color-24bit): Add new function to convert color palette index to
pixel value on 16.7M color terminals.
(tty-color-desc): Don't approximate colors on 16.7M color terminals.
* lisp/term/xterm.el (xterm-register-default-colors): Define all named
TTY colors on 16.7M color terminals.
---
lisp/term/tty-colors.el | 19 +++++++++++++++++--
lisp/term/xterm.el | 8 ++++++++
2 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/lisp/term/tty-colors.el b/lisp/term/tty-colors.el
index 252a430..9cfe30a 100644
--- a/lisp/term/tty-colors.el
+++ b/lisp/term/tty-colors.el
@@ -824,6 +824,15 @@ A canonicalized color name is all-lower case, with any blanks removed."
(replace-regexp-in-string " +" "" (downcase color))
color)))
+(defun tty-color-24bit (rgb)
+ "Return pixel value on 24-bit terminals. Return nil if RGB is
+nil or not on 24-bit terminal."
+ (when (and rgb (= (display-color-cells) 16777216))
+ (let ((r (lsh (car rgb) -8))
+ (g (lsh (cadr rgb) -8))
+ (b (lsh (nth 2 rgb) -8)))
+ (logior (lsh r 16) (lsh g 8) b))))
+
(defun tty-color-define (name index &optional rgb frame)
"Specify a tty color by its NAME, terminal INDEX and RGB values.
NAME is a string, INDEX is typically a small integer used to send to
@@ -840,7 +849,10 @@ If FRAME is not specified or is nil, it defaults to the selected frame."
(and rgb (or (not (listp rgb)) (/= (length rgb) 3))))
(error "Invalid specification for tty color \"%s\"" name))
(tty-modify-color-alist
- (append (list (tty-color-canonicalize name) index) rgb) frame))
+ (append (list (tty-color-canonicalize name)
+ (or (tty-color-24bit rgb) index))
+ rgb)
+ frame))
(defun tty-color-clear (&optional _frame)
"Clear the list of supported tty colors for frame FRAME.
@@ -1013,7 +1025,10 @@ might need to be approximated if it is not supported directly."
(let ((color (tty-color-canonicalize color)))
(or (assoc color (tty-color-alist frame))
(let ((rgb (tty-color-standard-values color)))
- (and rgb (tty-color-approximate rgb frame)))))))
+ (and rgb
+ (let ((pixel (tty-color-24bit rgb)))
+ (or (and pixel (cons color (cons pixel rgb)))
+ (tty-color-approximate rgb frame)))))))))
(defun tty-color-gray-shades (&optional display)
"Return the number of gray colors supported by DISPLAY's terminal.
diff --git a/lisp/term/xterm.el b/lisp/term/xterm.el
index 339d05d..e6d224d 100644
--- a/lisp/term/xterm.el
+++ b/lisp/term/xterm.el
@@ -930,6 +930,14 @@ versions of xterm."
;; are more colors to support, compute them now.
(when (> ncolors 0)
(cond
+ ((= ncolors 16777200) ; 24-bit xterm
+ ;; all named tty colors
+ (let ((idx (length xterm-standard-colors)))
+ (mapc (lambda (color)
+ (unless (assoc (car color) xterm-standard-colors)
+ (tty-color-define (car color) idx (cdr color))
+ (setq idx (1+ idx))))
+ color-name-rgb-alist)))
((= ncolors 240) ; 256-color xterm
;; 216 non-gray colors first
(let ((r 0) (g 0) (b 0))
--
2.7.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 3/4] Let user turn 24-bit terminal colors on.
2017-02-14 15:58 [PATCH v3 0/4] Support 24-bit terminal colors Rami Ylimäki
2017-02-14 15:58 ` [PATCH v3 1/4] Remove unused terminal color pair count Rami Ylimäki
2017-02-14 15:58 ` [PATCH v3 2/4] Support 24-bit terminal colors Rami Ylimäki
@ 2017-02-14 15:58 ` Rami Ylimäki
2017-02-14 15:58 ` [PATCH v3 4/4] Update documentation regarding 24-bit TTY colors Rami Ylimäki
2017-02-18 11:07 ` [PATCH v3 0/4] Support 24-bit terminal colors Eli Zaretskii
4 siblings, 0 replies; 14+ messages in thread
From: Rami Ylimäki @ 2017-02-14 15:58 UTC (permalink / raw)
To: emacs-devel
From: Rami Ylimäki <rjy@iki.fi>
ITU-T T.412 9.1.4 and ITU-T T.416 13.1.8 specify control function for
changing terminal foreground and background colors. One possible format
for the control function parameters is: 2:n:r:g:b, where 2 is color
access mode indicating direct RGB space, n is an indentifier that gives
detailed information about the color space and r, g, b are the color
values.
Most 24-bit terminals implement this function as 2;r;g;b. Color space
identifier has been omitted because of its complexity and rgb values are
assumed to be in range 0-255. Parameters are separated by semicolons
instead of colons for historical reasons.
The terminfo database supports only indexed color control functions and
can't be used to determine whether a terminal has implemented direct
color control functions.
However, this can be worked around by creating user defined functions
for setting 24-bit foreground and background colors. This can be done by
creating a terminfo source file with the required capabilities and
compiling a custom terminal type definition.
For example:
$ cat terminfo-24bit.src
# Replace semicolons with colons in setb24 and setf24 on terminals
# that use ITU-T separators (iTerm2). A 24-bit integer (p1) is given
# as a parameter to the control functions which calculate rgb
# component values with following formulas:
# r = p1 / 65536, g = (p1 / 256) & 255, b = p1 & 255
xterm-24bits|xterm with 16777216 colors,
use=xterm-256color,
setb24=\E[48;2;%p1%{65536}%/%d;%p1%{256}%/%{255}%&%d;%p1%{255}%&%dm,
setf24=\E[38;2;%p1%{65536}%/%d;%p1%{256}%/%{255}%&%d;%p1%{255}%&%dm,
$ tic -x -o ~/.terminfo terminfo-24bit.src
$ TERM=xterm-24bits emacs
* src/term.c (init_tty): Use 24-bit terminal colors if corresponding
foreground and background functions are present in terminal type
definition.
* src/tparam.h: Define prototype for tigetstr.
---
src/term.c | 14 ++++++++++++++
src/tparam.h | 4 ++++
2 files changed, 18 insertions(+)
diff --git a/src/term.c b/src/term.c
index b0ff9cb..35fa8c9 100644
--- a/src/term.c
+++ b/src/term.c
@@ -4131,6 +4131,20 @@ use the Bourne shell command 'TERM=...; export TERM' (C-shell:\n\
tty->TN_max_colors = tgetnum ("Co");
+#ifdef TERMINFO
+ /* Non-standard support for 24-bit colors. */
+ {
+ const char* fg = tigetstr ("setf24");
+ const char* bg = tigetstr ("setb24");
+ if (fg && bg && fg != (char *)-1 && bg != (char *)-1)
+ {
+ tty->TS_set_foreground = fg;
+ tty->TS_set_background = bg;
+ tty->TN_max_colors = 16777216;
+ }
+ }
+#endif
+
tty->TN_no_color_video = tgetnum ("NC");
if (tty->TN_no_color_video == -1)
tty->TN_no_color_video = 0;
diff --git a/src/tparam.h b/src/tparam.h
index 15664d6..02136b6 100644
--- a/src/tparam.h
+++ b/src/tparam.h
@@ -36,4 +36,8 @@ extern char PC;
extern char *BC;
extern char *UP;
+#ifdef TERMINFO
+char *tigetstr(const char *);
+#endif
+
#endif /* EMACS_TPARAM_H */
--
2.7.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v3 4/4] Update documentation regarding 24-bit TTY colors.
2017-02-14 15:58 [PATCH v3 0/4] Support 24-bit terminal colors Rami Ylimäki
` (2 preceding siblings ...)
2017-02-14 15:58 ` [PATCH v3 3/4] Let user turn 24-bit terminal colors on Rami Ylimäki
@ 2017-02-14 15:58 ` Rami Ylimäki
2017-02-18 11:07 ` [PATCH v3 0/4] Support 24-bit terminal colors Eli Zaretskii
4 siblings, 0 replies; 14+ messages in thread
From: Rami Ylimäki @ 2017-02-14 15:58 UTC (permalink / raw)
To: emacs-devel
From: Rami Ylimäki <rjy@iki.fi>
* doc/misc/efaq.texi: Add instructions on how to enable direct color TTY
mode.
* etc/NEWS: Mention direct color TTY mode and point to FAQ.
---
doc/misc/efaq.texi | 33 +++++++++++++++++++++++++++++++++
etc/NEWS | 5 +++++
2 files changed, 38 insertions(+)
diff --git a/doc/misc/efaq.texi b/doc/misc/efaq.texi
index f7a47f8..e9cfe7a 100644
--- a/doc/misc/efaq.texi
+++ b/doc/misc/efaq.texi
@@ -1491,6 +1491,39 @@ exhibits all the colors Emacs knows about on the current display.
Syntax highlighting is on by default since version 22.1.
+Emacs 26.1 and later support direct color mode in terminals. If Emacs
+finds Terminfo capabilities @samp{setb24} and @samp{setf24}, 24-bit
+direct color mode is used. The capability strings are expected to
+take one 24-bit pixel value as argument and transform the pixel to a
+string that can be used to send 24-bit colors to the terminal.
+
+There aren't yet any standard terminal type definitions that would
+support the capabilities, but Emacs can be invoked with a custom
+definition as shown below.
+
+@example
+$ cat terminfo-24bit.src
+
+# Use colon separators.
+xterm-24bit|xterm with 24-bit direct color mode,
+ use=xterm-256color,
+ setb24=\E[48:2:%p1%@{65536@}%/%d:%p1%@{256@}%/%@{255@}%&%d:%p1%@{255@}%&%dm,
+ setf24=\E[38:2:%p1%@{65536@}%/%d:%p1%@{256@}%/%@{255@}%&%d:%p1%@{255@}%&%dm,
+# Use semicolon separators.
+xterm-24bits|xterm with 24-bit direct color mode,
+ use=xterm-256color,
+ setb24=\E[48;2;%p1%@{65536@}%/%d;%p1%@{256@}%/%@{255@}%&%d;%p1%@{255@}%&%dm,
+ setf24=\E[38;2;%p1%@{65536@}%/%d;%p1%@{256@}%/%@{255@}%&%d;%p1%@{255@}%&%dm,
+
+$ tic -x -o ~/.terminfo terminfo-24bit.src
+
+$ TERM=xterm-24bit emacs -nw
+@end example
+
+Currently there's no standard way to determine whether a terminal
+supports direct color mode. If such standard arises later on, support
+for @samp{setb24} and @samp{setf24} may be removed.
+
@node Debugging a customization file
@section How do I debug a @file{.emacs} file?
@cindex Debugging @file{.emacs} file
diff --git a/etc/NEWS b/etc/NEWS
index 31b05dd..5cb4d02 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -77,6 +77,11 @@ modern init systems such as systemd, which manage many of the traditional
aspects of daemon behavior themselves. '--old-daemon' is now an alias
for '--daemon'.
++++
+** Terminal is initialized to use 24-bit colors if required
+capabilities are found from terminfo. See the FAQ node 'Colors on a
+TTY' for more information.
+
\f
* Changes in Emacs 26.1
--
2.7.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH v3 0/4] Support 24-bit terminal colors.
2017-02-14 15:58 [PATCH v3 0/4] Support 24-bit terminal colors Rami Ylimäki
` (3 preceding siblings ...)
2017-02-14 15:58 ` [PATCH v3 4/4] Update documentation regarding 24-bit TTY colors Rami Ylimäki
@ 2017-02-18 11:07 ` Eli Zaretskii
2017-02-19 2:22 ` Tino Calancha
4 siblings, 1 reply; 14+ messages in thread
From: Eli Zaretskii @ 2017-02-18 11:07 UTC (permalink / raw)
To: Rami Ylimäki; +Cc: emacs-devel
> From: Rami Ylimäki <rami.ylimaki@vincit.fi>
> Date: Tue, 14 Feb 2017 17:58:18 +0200
>
> From: Rami Ylimäki <rjy@iki.fi>
>
> Fixed since v2:
> * Replace '#if TERMINFO' with '#ifdef TERMINFO'.
> * Rename custom terminfo strings from 'seta[bf]24' to 'set[bf]24',
> because the 'a' in 'seta[bf]' stands for ANSI.
> * Update FAQ and NEWS.
> * Update commit messages to match FAQ.
>
> Rami Ylimäki (4):
> Remove unused terminal color pair count.
> Support 24-bit terminal colors.
> Let user turn 24-bit terminal colors on.
> Update documentation regarding 24-bit TTY colors.
>
> doc/misc/efaq.texi | 33 +++++++++++++++++++++++++++++++++
> etc/NEWS | 5 +++++
> lisp/term/tty-colors.el | 19 +++++++++++++++++--
> lisp/term/xterm.el | 8 ++++++++
> src/term.c | 20 ++++++++++++++------
> src/termchar.h | 4 ----
> src/tparam.h | 4 ++++
> 7 files changed, 81 insertions(+), 12 deletions(-)
Pushed to the master branch.
Thank you for working on this and for persevering.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v3 0/4] Support 24-bit terminal colors.
2017-02-18 11:07 ` [PATCH v3 0/4] Support 24-bit terminal colors Eli Zaretskii
@ 2017-02-19 2:22 ` Tino Calancha
2017-02-19 3:14 ` Black and white emacs -nw (WAS: Re: [PATCH v3 0/4] Support 24-bit terminal colors.) Kaushal Modi
2017-02-26 0:49 ` [PATCH v3 0/4] Support 24-bit terminal colors Charles Strahan
0 siblings, 2 replies; 14+ messages in thread
From: Tino Calancha @ 2017-02-19 2:22 UTC (permalink / raw)
To: Rami Ylimäki; +Cc: Emacs developers
[-- Attachment #1: Type: text/plain, Size: 1255 bytes --]
On Sat, 18 Feb 2017, Eli Zaretskii wrote:
>> From: Rami Ylimäki <rami.ylimaki@vincit.fi>
>> Date: Tue, 14 Feb 2017 17:58:18 +0200
>>
>> From: Rami Ylimäki <rjy@iki.fi>
>>
>> Fixed since v2:
>> * Replace '#if TERMINFO' with '#ifdef TERMINFO'.
>> * Rename custom terminfo strings from 'seta[bf]24' to 'set[bf]24',
>> because the 'a' in 'seta[bf]' stands for ANSI.
>> * Update FAQ and NEWS.
>> * Update commit messages to match FAQ.
>>
>> Rami Ylimäki (4):
>> Remove unused terminal color pair count.
>> Support 24-bit terminal colors.
>> Let user turn 24-bit terminal colors on.
>> Update documentation regarding 24-bit TTY colors.
>>
>> doc/misc/efaq.texi | 33 +++++++++++++++++++++++++++++++++
>> etc/NEWS | 5 +++++
>> lisp/term/tty-colors.el | 19 +++++++++++++++++--
>> lisp/term/xterm.el | 8 ++++++++
>> src/term.c | 20 ++++++++++++++------
>> src/termchar.h | 4 ----
>> src/tparam.h | 4 ++++
>> 7 files changed, 81 insertions(+), 12 deletions(-)
>
> Pushed to the master branch.
>
> Thank you for working on this and for persevering.
I also want to thank Rami for this work.
It's the first time i see such many colors in Emacs running
on Xterm. Very nice!
^ permalink raw reply [flat|nested] 14+ messages in thread
* Black and white emacs -nw (WAS: Re: [PATCH v3 0/4] Support 24-bit terminal colors.)
2017-02-19 2:22 ` Tino Calancha
@ 2017-02-19 3:14 ` Kaushal Modi
2017-02-19 3:20 ` Kaushal Modi
2017-02-26 0:49 ` [PATCH v3 0/4] Support 24-bit terminal colors Charles Strahan
1 sibling, 1 reply; 14+ messages in thread
From: Kaushal Modi @ 2017-02-19 3:14 UTC (permalink / raw)
To: Tino Calancha, Rami Ylimäki; +Cc: Emacs developers
[-- Attachment #1.1: Type: text/plain, Size: 1176 bytes --]
Hi Rami,
I followed these instructions in "(efaq) Colors on a TTY" after building
emacs from master that included your patches.
I followed your instructions to generate new terminfo and to set TERM.
But then emacs -Q -nw looks like this:
[image: pasted2]
I even tried setting TERMINFO env var to ~/.terminfo. But still get the
same thing.
Emacs build info: Emacs version: GNU Emacs 26.0.50 (build 32,
x86_64-unknown-linux-gnu, GTK+ Version 2.24.23)
of 2017-02-18, built using commit 861ff2ba2cfc19065b13bf9b9670b44e1496c64e.
./configure options:
--with-modules --prefix=/home/kmodi/usr_local/apps/6/emacs/master
'--program-transform-name=s/^ctags$/ctags_emacs/' 'CPPFLAGS=-fgnu89-inline
-I/home/kmodi/usr_local/6/include -I/usr/include/freetype2 -I/usr/include'
'CFLAGS=-ggdb3 -O0' 'CXXFLAGS=-ggdb3 -O0'
'LDFLAGS=-L/home/kmodi/usr_local/6/lib -L/home/kmodi/usr_local/6/lib64
-ggdb3'
Features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS
NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK2 X11 MODULES
xterm version: X.Org 6.8.99.903(325)
TERM set to xterm-24bit
What am I missing?
--
Kaushal Modi
[-- Attachment #1.2: Type: text/html, Size: 1714 bytes --]
[-- Attachment #2: pasted1 --]
[-- Type: image/png, Size: 329607 bytes --]
[-- Attachment #3: pasted2 --]
[-- Type: image/png, Size: 56085 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Black and white emacs -nw (WAS: Re: [PATCH v3 0/4] Support 24-bit terminal colors.)
2017-02-19 3:14 ` Black and white emacs -nw (WAS: Re: [PATCH v3 0/4] Support 24-bit terminal colors.) Kaushal Modi
@ 2017-02-19 3:20 ` Kaushal Modi
2017-02-19 6:22 ` Tino Calancha
0 siblings, 1 reply; 14+ messages in thread
From: Kaushal Modi @ 2017-02-19 3:20 UTC (permalink / raw)
To: Tino Calancha, Rami Ylimäki; +Cc: Emacs developers
[-- Attachment #1.1: Type: text/plain, Size: 1528 bytes --]
OK, that was uxterm.
But then I opened up xterm, set the env vars correctly.
Things were better (not black and white), but it was still only 256 colors,
not 24bit:
[image: pasted2]
On Sat, Feb 18, 2017 at 10:14 PM Kaushal Modi <kaushal.modi@gmail.com>
wrote:
> Hi Rami,
>
> I followed these instructions in "(efaq) Colors on a TTY" after building
> emacs from master that included your patches.
>
> I followed your instructions to generate new terminfo and to set TERM.
>
> But then emacs -Q -nw looks like this:
>
> [image: pasted2]
>
> I even tried setting TERMINFO env var to ~/.terminfo. But still get the
> same thing.
>
> Emacs build info: Emacs version: GNU Emacs 26.0.50 (build 32,
> x86_64-unknown-linux-gnu, GTK+ Version 2.24.23)
> of 2017-02-18, built using commit
> 861ff2ba2cfc19065b13bf9b9670b44e1496c64e.
>
> ./configure options:
> --with-modules --prefix=/home/kmodi/usr_local/apps/6/emacs/master
> '--program-transform-name=s/^ctags$/ctags_emacs/' 'CPPFLAGS=-fgnu89-inline
> -I/home/kmodi/usr_local/6/include -I/usr/include/freetype2 -I/usr/include'
> 'CFLAGS=-ggdb3 -O0' 'CXXFLAGS=-ggdb3 -O0'
> 'LDFLAGS=-L/home/kmodi/usr_local/6/lib -L/home/kmodi/usr_local/6/lib64
> -ggdb3'
>
> Features:
> XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS
> NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE LIBOTF XFT ZLIB
> TOOLKIT_SCROLL_BARS GTK2 X11 MODULES
>
> xterm version: X.Org 6.8.99.903(325)
>
> TERM set to xterm-24bit
>
> What am I missing?
> --
>
> Kaushal Modi
>
--
Kaushal Modi
[-- Attachment #1.2: Type: text/html, Size: 3223 bytes --]
[-- Attachment #2: pasted2 --]
[-- Type: image/png, Size: 56085 bytes --]
[-- Attachment #3: pasted2 --]
[-- Type: image/png, Size: 57120 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Black and white emacs -nw (WAS: Re: [PATCH v3 0/4] Support 24-bit terminal colors.)
2017-02-19 3:20 ` Kaushal Modi
@ 2017-02-19 6:22 ` Tino Calancha
2017-02-19 7:33 ` Kaushal Modi
0 siblings, 1 reply; 14+ messages in thread
From: Tino Calancha @ 2017-02-19 6:22 UTC (permalink / raw)
To: Kaushal Modi; +Cc: Emacs developers, Rami Ylimäki, Tino Calancha
[-- Attachment #1: Type: text/plain, Size: 794 bytes --]
On Sun, 19 Feb 2017, Kaushal Modi wrote:
> OK, that was uxterm.
> But then I opened up xterm, set the env vars correctly.
>
> Things were better (not black and white), but it was still only 256 colors, not 24bit:
Mine shows clear distinction on 'floralwhite' and 'oldlace' colors; in
your picture they looks pretty the same.
I assume you already have done a full bootstrap just in case.
I run in:
In GNU Emacs 26.0.50 (build 28, x86_64-pc-linux-gnu, GTK+ Version 3.22.7)
of 2017-02-19 built
Repository revision: 861ff2ba2cfc19065b13bf9b9670b44e1496c64e
Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS
NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 LIBSYSTEMD
$ xterm -version
XTerm(327)
[-- Attachment #2: Type: image/png, Size: 51860 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Black and white emacs -nw (WAS: Re: [PATCH v3 0/4] Support 24-bit terminal colors.)
2017-02-19 6:22 ` Tino Calancha
@ 2017-02-19 7:33 ` Kaushal Modi
2017-02-19 12:43 ` Rami Ylimäki
0 siblings, 1 reply; 14+ messages in thread
From: Kaushal Modi @ 2017-02-19 7:33 UTC (permalink / raw)
To: Tino Calancha; +Cc: Rami Ylimäki, Emacs developers
[-- Attachment #1: Type: text/plain, Size: 1270 bytes --]
I did some more testing.
I cannot set the 24-bit colors working on xterm directly.
But I sort of got it working in xterm via tmux configured for 24-bit
colors[1] after setting TERM to "xterm-24bits" (but it didn't work at all
when setting to "xterm-24bit" -- bit vs bits).
It's "sort of" because emacsclient -nw starts off with 24-bit colors, but
then after scrolling, I see color artifacts. This gifv shows that:
http://i.imgur.com/YW8MZat.gifv
[1]: https://sunaku.github.io/tmux-24bit-color.html
On Sun, Feb 19, 2017 at 1:22 AM Tino Calancha <tino.calancha@gmail.com>
wrote:
>
>
> On Sun, 19 Feb 2017, Kaushal Modi wrote:
>
> > OK, that was uxterm.
> > But then I opened up xterm, set the env vars correctly.
> >
> > Things were better (not black and white), but it was still only 256
> colors, not 24bit:
> Mine shows clear distinction on 'floralwhite' and 'oldlace' colors; in
> your picture they looks pretty the same.
>
> I assume you already have done a full bootstrap just in case.
>
I did not do a full bootstrap. But it still seems to work in uxterm in tmux
configured for 24-bits.
But it doesn't work directly in an xterm terminal.
What debug information can I provide from the direct xterm session or
xterm+tmux session?
Thanks.
--
Kaushal Modi
[-- Attachment #2: Type: text/html, Size: 2237 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Black and white emacs -nw (WAS: Re: [PATCH v3 0/4] Support 24-bit terminal colors.)
2017-02-19 7:33 ` Kaushal Modi
@ 2017-02-19 12:43 ` Rami Ylimäki
2017-02-19 15:21 ` Kaushal Modi
0 siblings, 1 reply; 14+ messages in thread
From: Rami Ylimäki @ 2017-02-19 12:43 UTC (permalink / raw)
To: Kaushal Modi; +Cc: Emacs developers, Tino Calancha
[-- Attachment #1: Type: text/plain, Size: 1643 bytes --]
2017-02-19 9:33 GMT+02:00 Kaushal Modi <kaushal.modi@gmail.com>:
I cannot set the 24-bit colors working on xterm directly.
>
XTerm supports the direct color mode escape sequences, but approximates
colors. See
https://gist.github.com/XVilka/8346728#parsing-ansi-colour-sequences-but-approximating-them-to-256-palette
and https://gist.github.com/XVilka/8346728#now-supporting-truecolour for
details.
Note that if you want to use XTerm, then using TERM=xterm-256color with
Emacs is enough, because 24-bit colors are approximated anyway.
I did not do a full bootstrap. But it still seems to work in uxterm in tmux
> configured for 24-bits.
> But it doesn't work directly in an xterm terminal.
>
> What debug information can I provide from the direct xterm session or
> xterm+tmux session?
>
I haven't used tmux before, but I was able to make Emacs work in direct
color mode with following steps:
* Use a terminal that supports 24-bit colors (gnome-terminal).
* Compile tmux from https://github.com/tmux/tmux.git. The version provided
with Ubuntu doesn't support Tc-flag.
* Use following terminfo source (add the Tc-flag and use semicolon
separators for tmux):
$ cat terminfo-24bit.src
# Use semicolon separators.
xterm-24bits|xterm with 24-bit direct color mode,
use=xterm-256color,
Tc,
setb24=\E[48;2;%p1%{65536}%/%d;%p1%{256}%/%{255}%&%d;%p1%{255}%&%dm,
setf24=\E[38;2;%p1%{65536}%/%d;%p1%{256}%/%{255}%&%d;%p1%{255}%&%dm,
* Compile the terminfo source, run tmux, set your TERM to xterm-24bits,
check that Tc is supported:
$ tmux info | grep Tc
199: Tc: (flag) true
* Finally run Emacs under tmux.
[-- Attachment #2: Type: text/html, Size: 2921 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Black and white emacs -nw (WAS: Re: [PATCH v3 0/4] Support 24-bit terminal colors.)
2017-02-19 12:43 ` Rami Ylimäki
@ 2017-02-19 15:21 ` Kaushal Modi
0 siblings, 0 replies; 14+ messages in thread
From: Kaushal Modi @ 2017-02-19 15:21 UTC (permalink / raw)
To: Rami Ylimäki; +Cc: Emacs developers, Tino Calancha
[-- Attachment #1: Type: text/plain, Size: 2207 bytes --]
On Sun, Feb 19, 2017 at 7:43 AM Rami Ylimäki <rami.ylimaki@vincit.com>
wrote:
>
> XTerm supports the direct color mode escape sequences, but approximates
> colors. See
> https://gist.github.com/XVilka/8346728#parsing-ansi-colour-sequences-but-approximating-them-to-256-palette
> and https://gist.github.com/XVilka/8346728#now-supporting-truecolour for
> details.
>
> Note that if you want to use XTerm, then using TERM=xterm-256color with
> Emacs is enough, because 24-bit colors are approximated anyway.
>
Thanks for that explanation; it helps understand why the colors don't
exactly look as in 24-bit mode. But that is much better than 256 colors! :)
> I did not do a full bootstrap. But it still seems to work in uxterm in
> tmux configured for 24-bits.
> But it doesn't work directly in an xterm terminal.
>
> What debug information can I provide from the direct xterm session or
> xterm+tmux session?
>
>
> I haven't used tmux before, but I was able to make Emacs work in direct
> color mode with following steps:
>
Wow! I cannot thank you enough! I really appreciate the effort you went
through to help me get this working.
> * Use a terminal that supports 24-bit colors (gnome-terminal).
>
Thanks. I will try that. But for now, with your fixed terminfo with Tc, it
works great in xterm too.
> * Compile tmux from https://github.com/tmux/tmux.git. The version
> provided with Ubuntu doesn't support Tc-flag.
>
> * Use following terminfo source (add the Tc-flag and use semicolon
> separators for tmux):
>
> $ cat terminfo-24bit.src
>
> # Use semicolon separators.
> xterm-24bits|xterm with 24-bit direct color mode,
> use=xterm-256color,
> Tc,
>
> setb24=\E[48;2;%p1%{65536}%/%d;%p1%{256}%/%{255}%&%d;%p1%{255}%&%dm,
>
> setf24=\E[38;2;%p1%{65536}%/%d;%p1%{256}%/%{255}%&%d;%p1%{255}%&%dm,
>
Thank you! This fixed the color anomaly I reported in my last email.
> * Compile the terminfo source, run tmux, set your TERM to xterm-24bits,
> check that Tc is supported:
>
> $ tmux info | grep Tc
> 199: Tc: (flag) true
>
> * Finally run Emacs under tmux.
>
Thanks again! :)
--
Kaushal Modi
[-- Attachment #2: Type: text/html, Size: 5821 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v3 0/4] Support 24-bit terminal colors.
2017-02-19 2:22 ` Tino Calancha
2017-02-19 3:14 ` Black and white emacs -nw (WAS: Re: [PATCH v3 0/4] Support 24-bit terminal colors.) Kaushal Modi
@ 2017-02-26 0:49 ` Charles Strahan
1 sibling, 0 replies; 14+ messages in thread
From: Charles Strahan @ 2017-02-26 0:49 UTC (permalink / raw)
To: emacs-devel
Thanks a ton, Rami! I owe you a <beverage-of-choice>!
On Sat, Feb 18, 2017, at 09:22 PM, Tino Calancha wrote:
>
>
> On Sat, 18 Feb 2017, Eli Zaretskii wrote:
>
> >> From: Rami Ylimäki <rami.ylimaki@vincit.fi>
> >> Date: Tue, 14 Feb 2017 17:58:18 +0200
> >>
> >> From: Rami Ylimäki <rjy@iki.fi>
> >>
> >> Fixed since v2:
> >> * Replace '#if TERMINFO' with '#ifdef TERMINFO'.
> >> * Rename custom terminfo strings from 'seta[bf]24' to 'set[bf]24',
> >> because the 'a' in 'seta[bf]' stands for ANSI.
> >> * Update FAQ and NEWS.
> >> * Update commit messages to match FAQ.
> >>
> >> Rami Ylimäki (4):
> >> Remove unused terminal color pair count.
> >> Support 24-bit terminal colors.
> >> Let user turn 24-bit terminal colors on.
> >> Update documentation regarding 24-bit TTY colors.
> >>
> >> doc/misc/efaq.texi | 33 +++++++++++++++++++++++++++++++++
> >> etc/NEWS | 5 +++++
> >> lisp/term/tty-colors.el | 19 +++++++++++++++++--
> >> lisp/term/xterm.el | 8 ++++++++
> >> src/term.c | 20 ++++++++++++++------
> >> src/termchar.h | 4 ----
> >> src/tparam.h | 4 ++++
> >> 7 files changed, 81 insertions(+), 12 deletions(-)
> >
> > Pushed to the master branch.
> >
> > Thank you for working on this and for persevering.
> I also want to thank Rami for this work.
> It's the first time i see such many colors in Emacs running
> on Xterm. Very nice!
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2017-02-26 0:49 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-14 15:58 [PATCH v3 0/4] Support 24-bit terminal colors Rami Ylimäki
2017-02-14 15:58 ` [PATCH v3 1/4] Remove unused terminal color pair count Rami Ylimäki
2017-02-14 15:58 ` [PATCH v3 2/4] Support 24-bit terminal colors Rami Ylimäki
2017-02-14 15:58 ` [PATCH v3 3/4] Let user turn 24-bit terminal colors on Rami Ylimäki
2017-02-14 15:58 ` [PATCH v3 4/4] Update documentation regarding 24-bit TTY colors Rami Ylimäki
2017-02-18 11:07 ` [PATCH v3 0/4] Support 24-bit terminal colors Eli Zaretskii
2017-02-19 2:22 ` Tino Calancha
2017-02-19 3:14 ` Black and white emacs -nw (WAS: Re: [PATCH v3 0/4] Support 24-bit terminal colors.) Kaushal Modi
2017-02-19 3:20 ` Kaushal Modi
2017-02-19 6:22 ` Tino Calancha
2017-02-19 7:33 ` Kaushal Modi
2017-02-19 12:43 ` Rami Ylimäki
2017-02-19 15:21 ` Kaushal Modi
2017-02-26 0:49 ` [PATCH v3 0/4] Support 24-bit terminal colors Charles Strahan
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.