From a6f758e81a869f69939b73c54766d54e1dfc41ad Mon Sep 17 00:00:00 2001
From: Brad Town <brad@bradtown.com>
Date: Sat, 20 Nov 2021 19:14:42 -0800
Subject: [PATCH] Update documentation and syntax highlighting for #rgb color
 format.

Signed-off-by: Brad Town <brad@bradtown.com>
---
 doc/nano.texi        | 10 ++++++++++
 doc/nanorc.5         | 10 ++++++++++
 syntax/nanorc.nanorc |  4 ++--
 3 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/doc/nano.texi b/doc/nano.texi
index f14502de..09bad210 100644
--- a/doc/nano.texi
+++ b/doc/nano.texi
@@ -925,6 +925,11 @@ other valid (but unprefixable) color names are:
 @code{lagoon}, @code{mint}, @code{lime},
 @code{peach}, @code{orange}, @code{latte}, and @code{normal}
 --- where @code{normal} means the default foreground or background color.
+On such emulators, the color name may be given as a three-digit hexadecimal
+number prefixed with "#", with the digits representing red, green, and blue,
+respectively. This allows @command{nano} to select a color from the available
+palette approximating the values given.
+
 Either @var{fgcolor} or ,@var{bgcolor} may be left out,
 and the pair may be preceded by @code{bold} and/or @code{italic}
 (separated by commas) to get a bold and/or slanting typeface,
@@ -1262,6 +1267,11 @@ other valid (but unprefixable) color names are:
 @code{lagoon}, @code{mint}, @code{lime},
 @code{peach}, @code{orange}, @code{latte}, and @code{normal}
 --- where @code{normal} means the default foreground or background color.
+On such emulators, the color name may be given as a three-digit hexadecimal
+number prefixed with "#", with the digits representing red, green, and blue,
+respectively. This allows @command{nano} to select a color from the available
+palette approximating the values given.
+
 The color pair may be preceded by @code{bold} and/or @code{italic}
 (separated by commas) to get a bold and/or slanting typeface,
 if your terminal can do those.
diff --git a/doc/nanorc.5 b/doc/nanorc.5
index 91305ed7..55fb7740 100644
--- a/doc/nanorc.5
+++ b/doc/nanorc.5
@@ -365,6 +365,11 @@ other valid (but unprefixable) color names are:
 .BR pink ", " purple ", " mauve ", " lagoon ", " mint ", "
 .BR lime ", " peach ", " orange ", " latte ", and " normal
 -- where \fBnormal\fR means the default foreground or background color.
+On such emulators, the color name may be given as a three-digit hexadecimal
+number prefixed with "#", with the digits representing red, green, and blue,
+respectively. This allows \fBnano\fR to select a color from the available
+palette approximating the values given.
+
 Either "\fIfgcolor\fR" or "\fB,\fIbgcolor\fR" may be left out,
 and the pair may be preceded by \fBbold\fR and/or \fBitalic\fR
 (separated by commas) to get a bold and/or slanting typeface,
@@ -498,6 +503,11 @@ other valid (but unprefixable) color names are:
 .BR pink ", " purple ", " mauve ", " lagoon ", " mint ", "
 .BR lime ", " peach ", " orange ", " latte ", and " normal
 -- where \fBnormal\fR means the default foreground or background color.
+On such emulators, the color name may be given as a three-digit hexadecimal
+number prefixed with "#", with the digits representing red, green, and blue,
+respectively. This allows \fBnano\fR to select a color from the available
+palette approximating the values given.
+
 The color pair may be preceded by \fBbold\fR and/or \fBitalic\fR
 (separated by commas) to get a bold and/or slanting typeface,
 if your terminal can do those.
diff --git a/syntax/nanorc.nanorc b/syntax/nanorc.nanorc
index 0d33662e..e285c557 100644
--- a/syntax/nanorc.nanorc
+++ b/syntax/nanorc.nanorc
@@ -7,7 +7,7 @@ comment "#"
 color brightred ".*"
 
 # Color names
-color yellow "^[[:blank:]]*(i?color|set[[:blank:]]+((error|function|key|mini|number|prompt|scroller|selected|spotlight|status|stripe|title)color))[[:blank:]]+(bold,)?(italic,)?(((bright|light)?(white|black|red|blue|green|yellow|magenta|cyan))|normal|pink|purple|mauve|lagoon|mint|lime|peach|orange|latte|grey|gray)?(,(((light)?(white|black|red|blue|green|yellow|magenta|cyan))|normal|pink|purple|mauve|lagoon|mint|lime|peach|orange|latte|grey|gray))?\>"
+color yellow "^[[:blank:]]*(i?color|set[[:blank:]]+((error|function|key|mini|number|prompt|scroller|selected|spotlight|status|stripe|title)color))[[:blank:]]+(bold,)?(italic,)?(((bright|light)?(white|black|red|blue|green|yellow|magenta|cyan))|normal|pink|purple|mauve|lagoon|mint|lime|peach|orange|latte|grey|gray|#[0-9A-Fa-f]{3})?(,(((light)?(white|black|red|blue|green|yellow|magenta|cyan))|normal|pink|purple|mauve|lagoon|mint|lime|peach|orange|latte|grey|gray|#[0-9A-Fa-f]{3}))?\>"
 
 # Keywords
 color brightgreen "^[[:blank:]]*(set|unset)[[:blank:]]+(afterends|allow_insecure_backup|atblanks|autoindent|backup|boldtext|bookstyle|breaklonglines|casesensitive|constantshow|cutfromcursor|emptyline|historylog|indicator|jumpyscrolling|linenumbers|locking|magic|minibar|mouse|multibuffer|noconvert|nohelp|nonewlines|positionlog|preserve|quickblank|rawsequences|rebinddelete|regexp|saveonexit|showcursor|smarthome|softwrap|stateflags|tabstospaces|trimblanks|unix|wordbounds|zap|zero)\>"
@@ -29,7 +29,7 @@ color magenta "^[[:blank:]]*i?color\>|[[:blank:]](start=|end=)"
 color bold,pink "[[:cntrl:]]"
 
 # Comments
-color brightblue "(^|[[:blank:]]+)#.*"
+color brightblue "^[[:blank:]]*#.*|[[:blank:]]#[[:blank:]].*"
 color cyan "^[[:blank:]]*##.*"
 
 # Trailing whitespace
-- 
2.34.0.rc2.393.gf8c9666880-goog

