Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
ReedN
Wizard


Joined: 04 Jan 2006
Posts: 1279
Location: Portland, Oregon

PostPosted: Sat Mar 07, 2009 9:05 pm   

[3.04] #cw not handling the white background
 
Using #CW blue,white should paint the foreground blue and the background white (compare #CW blue,ivory which works). Instead it uses black as the foreground, blue as the background and puts it in italics and blinking.

Import this and type 'go'
Code:

<class name="test2" id="13">
  <alias name="go" id="14">
    <value>#say test</value>
  </alias>
  <trigger priority="150" regex="true" id="15">
    <pattern>\b(test)\b</pattern>
    <value>#cw blue,white</value>
  </trigger>
</class>
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sun Mar 08, 2009 9:50 am   
 
The reason is that "blue,white" uses the ansi color pallette. The ansi pallette only allows 8 colors for the background. If you count the names in the %color help white is 9; it is actually a shortcut for high,gray.

What you want is "blue,mxpwhite".
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
ReedN
Wizard


Joined: 04 Jan 2006
Posts: 1279
Location: Portland, Oregon

PostPosted: Sun Mar 08, 2009 3:53 pm   
 
I was scouring the help trying to figure this out before I posted. There just wasn't a whole lot of information. I was looking at the help for #CW and #color among others, but I still came up dry. Where can I get more information on what you posted about white being a shortcut for high,gray?

Here's the help for %color which you mentioned, but how'd you get what you said from this help?

Code:

color

Syntax: %color(fore,back)

 converts a descriptive color into an attribute value. You can use the following special strings for certain effects:
   hi highlight (select highlighted color)
   bold bold text
   rev reverse video
   blink blinking text
   under underlined text

Recognized color names:
 black, blue, green, cyan, red, magenta, brown, gray, yellow, white

Examples:

 #SHOW %color(red,magenta)
    outputs 84

#COLOR %eval(%color(hi)+%color(blink)+%color(rev)+%color(blue,grey))
    colors the last line in the output buffer in a flashy manner. You need the %eval in order to add up the colors into a single number.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sun Mar 08, 2009 5:40 pm   
 
Count with me
Code:

black, blue, green, cyan, red, magenta, brown, gray, yellow, white
   0     1     2      3    4      5       6      7
That makes 8. Arcane knowledge of the ansi escape sequences is what lets me know that 8 is the allowed number of background colors, and what led to me sorting the names into that particular order in the help. Knowing that the ansi names are tried and validated first is another piece of arcane knowledge.

I don't know why Zugg didn't make shortcuts for all the high colors (darkgray=high,black), but it has been that way since very early zMud. I thought I put a link to %colornames prominently somewhere in %color, but I guess I just left it to the related function list; or figured that people that wanted more colors would find it based on the command they were actually using to do the coloring.

#CW does reference %colornames which includes "mxpwhite". There are no explanations of anything there.

Maybe it is time to switch the order in which names are interpretted for the various coloring commands. The %color and %ansi functions should remain constrained.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Mon Mar 09, 2009 5:38 pm   
 
In any case, ReedN still has a point that this doesn't work the way one would expect.

Vijilante is correct in his analysis. ANSI has 16 foreground colors, but only 8 background colors. "White" is the name for the foregound color #15. And this color index doesn't exist for a background color (which only has indexes 0-7). You'll see the same problem if you try to use "yellow", which is the name for foreground color #14.

There are only a couple of colors that have different foreground/background color names. As Vijilante said, I didn't ever create color shortcut names for all of the highlighted colors. But "White" was added to be different than gray/silver, and Yellow was added to be different than Olive because these were common color names. There was no standard naming at the time to distinguish between the dark red and the light red, or the dark green and light green, etc.

But in any case, and regardless of the history and implementation details, when someone says "#CW blue,white" or "#CW blue,yellow" then it really should just work, so I still consider this a bug and have added it to the bug list.
Reply with quote
ReedN
Wizard


Joined: 04 Jan 2006
Posts: 1279
Location: Portland, Oregon

PostPosted: Mon Mar 09, 2009 6:00 pm   
 
I think Vijilante's explanation just created more confusion for me regarding how this works. I understand that the name colors are referencing numerical colors, but what most confuses me is that if white doesn't map properly because there are only 8 possible colors, then how was I using 'ivory' and 'redbrick' without there being a mapping issue as well? Those esoteric colors somehow map back correctly to one of the 8 possible colors, but white doesn't?
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Mon Mar 09, 2009 6:56 pm   
 
When using color names, CMUD first checks the ANSI color names, and if a match isn't found, only then does it look for MXP color names. "ivory" and "redbrick" are MXP color names, so that causes #CW to generate MXP COLOR tags. But when the color name matches an ANSI color name (like red, blue, white, yellow, etc), then #CW is using the %ansi function to generate the colors. When you use "blue,white", the "white" matches ANSI color 15, and CMUD then tries to use a color index of 15 for the background color, but background colors only have 8 values. So it ends up with just blank, or uses an undefined color record.

The bug is that CMUD should only be matching the names of the first 8 ANSI colors when parsing the background color name. Using "white" or "yellow" for the background should trigger the MXP color mode, just like using "mxpwhite" already does.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net