Re: Inline Color Questions

From: Daniel A. Koepke (dkoepke@circlemud.org)
Date: 08/01/02


On Thu, 1 Aug 2002, Mathew Earle Reuther wrote:

> [snip issues with interpret_colors()]

Aside from a dumb bug that lives in that code (note that it always sets
bg_clr to 40 instead of to the color from is_color()), the main problem
you're having is probably that the code doesn't work how you expect it to.
It was rewritten to play nicely in the presence of other color systems
(such as the stock CircleMUD system) changing terminal attributes.  This
means that it needs to send control sequences to set _all_ of its
attributes whenever it needs to send one.

When it's put in the role of the primary color system, it's more
convenient to make the function eschew states altogether.  This can be
accomplished by replacing the use of the graphic rendition code 0 (reset
all attributes to defaults) with codes 21 (disable bold) and 25 (diable
flash) where appropriate.  Additionally, we will need to change &f from a
toggle (since toggles require state) to the new codes &F (enable flash)
and &f (disable flash).

This means we need to make a few small changes to the heart of the
interpret_colors() function so that it looks something like the following
mailer code:

     if (*str == '&') {
       str++;
       if ((clr = is_color(LOWER(*str))) > 0 && parse) {
         if (clr >= 40)
           sprintf(i, "\x1B[%dm", clr);
         else if (clr == 1)
           sprintf(i, "\x1B[%sm", (isupper(*str) ? "5" : "25"));
         else
           sprintf(i, "\x1B[%s;%dm", (isupper(*str) ? "1" : "21"), clr);
         tmp = i;
       } else if (clr == -1) {

-dak

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/25/03 PDT