nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nano-devel] A patch for added color support


From: Erik Lundin
Subject: Re: [Nano-devel] A patch for added color support
Date: Sun, 12 Oct 2014 13:57:47 +0200

Thanks for the feedback. Looking further into this i found that ncurses has a global variable named COLORS which holds the maximum number of colors. It would probably be the easiest way to get the number. However as i see it, there are two approaches to this. Should the colors be silently ignored at draw time if the terminal doesn't support it or should they be ignored at load time? Using the COLOR method wouldn't work if it's ignored at load time since the variable isn't populated until after ncurses is initialized and that happens after the rcfile is loaded.

I think that if the nanorc file defines colors in foreground or background that's not supported by the terminal, it should revert back to the standard colors for that section. It would be the safe way of being able to read the text. If a user defines the color black as foreground color and then a greenish extended color as background. If the valid color "black" is used as foreground and the standard terminal background color is black, the text would be unreadable.

I agree with the question marks comment.

Here's a wikipedia link that shows the color chart: http://upload.wikimedia.org/wikipedia/en/1/15/Xterm_256color_chart.svg

Btw, thanks for an awesome editor. I use it daily in both work and at home. :)


2014-10-12 12:01 GMT+02:00 Eitan Adler <address@hidden>:
On 12 October 2014 02:18, Benno Schulenberg <address@hidden> wrote:
>
> Hello Erik,
>
> On Sat, Oct 11, 2014, at 13:28, Erik Lundin wrote:
>> I have created a patch to add support for 256 colors in nano. What do you
>> think?
>
> Nice!  However, the detection whether the terminal supports 256 colours
> is in my opinion too simple.  My TERM is set by default to "xterm", so with
> your patch I don't get more than sixteen colours.  But if I simply set TERM
> to "xterm-256color", I do get the 256 colours.  So... how does one find out
> properly whether the terminal is /capable/ of more than sixteen colours?

+1.  The specific check for xterm-256color is not good, especially
where tmux or screen is used.

Based on documentation it should be possible to use tgetnum("Co") to
determine the maximum number of colors supported. I'm unsure if this
is accurate.

> About the patch itself: I don't like the use of question marks in color???
> to indicate that three decimal digits have to be filled in; I would prefer
> something like colorxxx.  Also, it is completely unclear to me how the
> xxx numbers choose a color.  This should be tersely explained in the
> man page, I think -- maybe with a link to a Wikipedia article that has
> all the details and colourful examples?

General question:  If a color is set which is beyond the capability of
the terminal, do we want to do nothing, or do we want to clamp the
color one of the available, more limited set?


> Thanks for the patch, it is a nice start.

+1.  Thanks for working on it!



--
Eitan Adler



--
Mvh, Erik Lundin
E-post: address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]