changeset 1417:783b47c9d963

Allow more than the 16 default colors (patch from mjs) If the terminal supports more than 16 colors (e.g. xterm-256color), the color numbers can be set in place of the color names.
author Mikael Berthe <mikael@lilotux.net>
date Sun, 20 Jan 2008 22:46:16 +0100
parents 7f0da8de2a7d
children f69028ca6296
files mcabber/mcabberrc.example mcabber/src/screen.c
diffstat 2 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/mcabberrc.example	Sat Jan 19 16:52:45 2008 +0100
+++ b/mcabber/mcabberrc.example	Sun Jan 20 22:46:16 2008 +0100
@@ -286,9 +286,11 @@
 # Colors are: black, red, green, yellow, blue, magenta, cyan, white
 # For text colors (i.e. not background and bg* colors) you can also use
 # the "bright" prefix to get a bright/bold color.  Example: brightblue
-# You can use the "default" color, too (i.e. for transparent background)
+# You can use the "default" color, too (i.e. for transparent background).
+# If your terminal supports 256 colors, you can use the color number
+# directly (16-255).
 #
-# You can have a look at the contrib/themes/ directory to see some sample
+# Have a look at the contrib/themes/ directory to see some sample
 # color settings.
 #
 # background: background color of the chat window and the log window
--- a/mcabber/src/screen.c	Sat Jan 19 16:52:45 2008 +0100
+++ b/mcabber/src/screen.c	Sun Jan 20 22:46:16 2008 +0100
@@ -246,6 +246,11 @@
   if (result != -2)
     return result;
 
+  // Directly support 256-color values
+  result = atoi(name);
+  if (result > 0 && result < COLORS)
+    return result;
+
   scr_LogPrint(LPRINT_LOGNORM, "ERROR: Wrong color: %s", name);
   return -1;
 }