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: Benno Schulenberg
Subject: Re: [Nano-devel] A patch for added color support
Date: Mon, 13 Oct 2014 21:29:55 +0200

On Sun, Oct 12, 2014, at 13:57, Erik Lundin wrote:
> 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?

At load time, I would say.  When the rcfile defines colours of which the
current terminal is not capable, parsing the rcfile should print warnings.

But it seems that that won't work.  I've added the following lines at
various places in main(), and only get 256 as an answer (instead of 0 and -1)
when curses mode and the screen have already been initialized:

    fprintf(stderr, "\n *** Curses colors: %i\n\r", COLORS);
    fprintf(stderr, "\n *** Color capability: %i\n\n", tgetnum("Co"));
    sleep(2);

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

Well, when the user is advanced enough to be fiddling with extended
colors, he or she also knows how to blindly exit from nano when things
have become unreadable and then readjust the rcfile.  So I would say:
if an extened colour is not available, go to the nearest colour that is.

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

Nice.  To me it seems unexplainable how the decimal numbers translate
to a six-digit hexadecimal RGB code.  So a link to the above graphic would
definitely be useful.  (BTW, in the graphic the used subcodes seem to be
regular: 00, 5f, 87, af, d7, and ff.  But in the third block there are several
that say df -- would that be correct?  And if so, what is the logic there?)

Benno

-- 
http://www.fastmail.fm - Access your email from home and the web




reply via email to

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