nano-devel
[Top][All Lists]
Advanced

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

[Nano-devel] [PATCH] bright colors without bold


From: Brand Huntsman
Subject: [Nano-devel] [PATCH] bright colors without bold
Date: Mon, 22 Jan 2018 18:48:57 -0700

With index colors patch, it is possible to use 8-15 for bright foreground and 
background colors. But if you then switch to linux console nano will complain 
and ignore the color command. I'm no longer sure if nano should even support 
index colors.

The attached patches solve that problem by only making the color bright on 
terminals with more than 8 colors, or making the color bold on 8-color 
terminals. Easy to remember names can be used and the color won't break on some 
terminals.

The first patch adds a "brightisnotbold" command that changes the behavior of 
the bright prefix on named colors. If used in nanorc it only applies to colors 
used in the global scope, currently only UI colors. When used in a syntax, it 
alters all color commands below it. It should be placed at the top after all 
bright prefixes have been converted to bold attributes. But it could 
technically be placed anywhere in the syntax, and color commands above it 
wouldn't need conversion. UI colors and syntaxes only need conversion if a 
non-bold bright color is wanted.
CON: must check for a brightisnotbold to understand what bright prefix does.

Second patch adds a new ! prefix to make bright colors. It wouldn't require 
changing existing bright-prefixed colors to use it.
CON: bright means bold, and ! means bright.

Both options could be used, if wanted. But the two patches can't be applied 
together.

It is also possible to brighten background colors. I chose not to add support 
because it doesn't work with 8-color terminals. Using the reverse attribute 
with a bright foreground will result in a bright background 
("reverse,!red,black" -> "black,!red"). It just isn't possible to use both a 
bright foreground and bright background together, on 8-color with ncurses.

Attachment: 1-bright-is-not-bold-toggle-for-UI-colors-and-per-syntax.patch
Description: Text Data

Attachment: 2-non-bold-bright-colors.patch
Description: Text Data


reply via email to

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