[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Suggestions
. . -> [Subject]  xTerm support...

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?
(New message)
Subject: xTerm support...
Name:
Your forum user name.
Register forum user name
Password:
Your forum password.
Forgotten password?
Message:
Message to be posted (in English, please).
Forum codes:
Check this if your message uses 'forum codes' or templates (auto-detected for new posts).
Forum codes Templates

Save this message ...


Subject review (reverse sequence)

Pages: 1 2  3  4  

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Sun 08 Apr 2007 09:07 PM (UTC)  quote  ]
Message
Please make posts about adding to the colour picker to this thread:

http://www.gammon.com.au/forum/?id=7775

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio   Moderator
Date Sun 08 Apr 2007 01:17 AM (UTC)  quote  ]
Message
Quote:
Are we agreed that the 6x6x6 colour cube is the correct one?
Nick, yes, that color cube is consistent with what I have seen elsewhere.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
[Go to top] top

Posted by Shaun Biggs   USA  (644 posts)  [Biography] bio
Date Sat 07 Apr 2007 11:37 PM (UTC)  quote  ]
Message
Quote:
Its not like, if you allowed naming of user customized colors, that those would be supported in MXP either, it just makes it easier to use the name given to them, rather than trying to remember the hex codes.

So it's easier to remember a whole bunch of different names for colours? I personally would find that much more difficult to do. If you want to add in the colour names to plugins, just define them in the plugin.

<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE muclient[
  <!ENTITY player_name 
   "Balaam" >
  <!ENTITY info_colour
   "11" >
]>


These are the first 7 lines of a plugin I made to keep track of player kills. I put in entities so that people could change their name and the colour which they preferred for display. Every time the player's name is in a trigger, &player_name is substituted so that the triggers don't have to be changed one by one for everyone using the script.

It is much easier to fight for one's ideals than to live up to them.
[Go to top] top

Posted by Shadowfyr   USA  (1,774 posts)  [Biography] bio
Date Sat 07 Apr 2007 11:13 PM (UTC)  quote  ]

Amended on Sun 08 Apr 2007 09:03 PM (UTC) by Nick Gammon

Message
Quote:
So are you suggesting a regression here?


No, I just mentioned that based on the way palettes where normally handled, it violated the standard, not that we should revert it. Sheesh...

Quote:
So when I use the hexadecimal codes or use AdjustColour for ColourNote, what exactly am I doing? Am I just wasting typing and not changing the colour displayed at all?



Moved discussion about custom colours to:


http://www.gammon.com.au/forum/?id=7775


- Nick Gammon

main {
__if (Schrodinger_Cat is Alive or version >= "XP"){
____if version = "Vista" then Performance /= Number_of_Cores;
____call Functional_Code();}
__else
____call Crash_Windows();}
[Go to top] top

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Sat 07 Apr 2007 10:53 PM (UTC)  quote  ]

Amended on Sat 07 Apr 2007 11:00 PM (UTC) by Nick Gammon

Message
For the benefit of other client developers, here is the code I eventually used to generate all 256 entries:


// defines in case you are not using Windows:

// typedef unsigned long  COLORREF;
// typedef unsigned char  BYTE;
// typedef unsigned short WORD;
// #define RGB(r,g,b)  ((COLORREF)(((BYTE)(r)|((WORD)((BYTE)(g))<<8))|(((DWORD)(BYTE)(b))<<16)))
 

COLORREF xterm_256_colours [256];


void Generate256colours (void)
  {

  // standard 16 ANSI colours

  xterm_256_colours   [0] = RGB (0, 0, 0);         // (black)       
  xterm_256_colours   [1] = RGB (128, 0, 0);       // (maroon)      
  xterm_256_colours   [2] = RGB (0, 128, 0);       // (green)       
  xterm_256_colours   [3] = RGB (128, 128, 0);     // (olive)       
  xterm_256_colours   [4] = RGB (0, 0, 128);       // (navy)        
  xterm_256_colours   [5] = RGB (128, 0, 128);     // (purple)      
  xterm_256_colours   [6] = RGB (0, 128, 128);     // (teal)        
  xterm_256_colours   [7] = RGB (192, 192, 192);   // (silver)      
                       
  xterm_256_colours   [8]  = RGB (128, 128, 128);  // (gray)                 
  xterm_256_colours   [9]  = RGB (255, 0, 0);      // (red)               
  xterm_256_colours   [10] = RGB (0, 255, 0);      // (lime)              
  xterm_256_colours   [11] = RGB (255, 255, 0);    // (yellow)            
  xterm_256_colours   [12] = RGB (0, 0, 255);      // (blue)              
  xterm_256_colours   [13] = RGB (255, 0, 255);    // (magenta)  
  xterm_256_colours   [14] = RGB (0, 255, 255);    // (cyan)        
  xterm_256_colours   [15] = RGB (255, 255, 255);  // (white)             

// This gives even 6x6x6 colour cube
//  there are 6 colours in the cube, but only 5 gaps:
//   Thus the colours will be: 0x00 / 0x33 / 0x66 / 0x99 / 0xCC / 0xFF

  const BYTE colour_increment = 255 / 5;     // that is, 51 (0x33)

  int red, green, blue;

  for (red = 0; red < 6; red++)
      for (green = 0; green < 6; green++)
        for (blue = 0; blue < 6; blue++)
           xterm_256_colours [16 + (red * 36) + (blue * 6) + green] =
              RGB (red   * colour_increment, 
                   blue  * colour_increment, 
                   green * colour_increment);


  // finish off with 24 greyscale colours  

  int grey;
  for (grey = 0; grey < 24; grey++)
    {
    BYTE value = 8 + (grey * 10);
    xterm_256_colours [232 + grey] = RGB (value, value, value);
    }

  } // end of Generate256colours


- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Sat 07 Apr 2007 10:35 PM (UTC)  quote  ]
Message
Quote:

At least one Linux/Unix based list of web colors I found included about 4-5 times as many, since it allowed for things like "Light Rose 2", "Light Rose", "Dark Rose 2" and "Dark Rose", instead of just "Rose", or even Light and Dark versions only.


I should point out also that, AFAIK, zMUD has MXP support for the exact same list of colours as MUSHclient, and I don't want to encourage a "client war" where multiple clients all support different colour names, and thus MUD developers aren't sure which colours they can safely use when writing MXP. At least, at present, any colour in the MUSHclient colour picker should be supported.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Sat 07 Apr 2007 10:13 PM (UTC)  quote  ]
Message
Quote:

Mushclient violates the rule of not changing the base 16 ANSI colors ...


Ah, I thought you were going to object I didn't have the right codes for the 16 base colours.




I know this is now a long thread, but two things I wanted to check are:


  1. Are we agreed that the 6x6x6 colour cube is the correct one? The one shown most recently, with a gap of 51 between each RGB value?

  2. Are we agreed that if the "inverse" attribute is currently set, then the set foreground/background sense is reversed (see earlier post).


- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Shaun Biggs   USA  (644 posts)  [Biography] bio
Date Sat 07 Apr 2007 09:57 PM (UTC)  quote  ]

Amended on Sat 07 Apr 2007 10:02 PM (UTC) by Shaun Biggs

Message
Quote:
Mushclient violates the rule of not changing the base 16 ANSI colors because we "can" already edit them. ".pal" files generally have the first 16 and the last 8? as default settings, this was a convention from the old days where the applications had to use the same color palette as the OS, so if you changed the first 16 or the grey scale either a) Your the OS would replace the images first 16 and last 8 with its standards, messing up the picture, or in more unusual cases, the applications colors would get changed to match the image (which in some cases could be very bad). So, Mushclient is violating the rules by allowing you to change those colors.

So are you suggesting a regression here? The reason that MUSHclient does not violate ANSI standards for this is because MC will display whatever colour the colour codes said to. You can alter how these codes look, similar to changing the palate 15 years ago. If you want to have them go back to a standard definition, there is a button in the ANSI colour section to allow you to go back to the normal colours.

Quote:
Umm. Thinking more in terms of the script. If you want "powderblue4", you can't tell it, "Use powderblue, but make it X% darker." You would have to return the actual RGB color for it, break that into its components, calculate the darker/lighter color, glue the conponents back together, then send that result to through the colornote command.

So when I use the hexadecimal codes or use AdjustColour for ColourNote, what exactly am I doing? Am I just wasting typing and not changing the colour displayed at all? I could have sworn that works in all of my plugins, including the one that uses this to have gradients in the colour displayed in a line of text. Must be my imagination.


And once again, I have to mention that MUSHclient is open source. If you feel this strongly about something that the main developer does not agree with, start coding.

It is much easier to fight for one's ideals than to live up to them.
[Go to top] top

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Sat 07 Apr 2007 09:45 PM (UTC)  quote  ]
Message
Quote:

You would have to return the actual RGB color for it, break that into its components, calculate the darker/lighter color, glue the conponents back together, then send that result to through the colornote command.


See: http://www.gammon.com.au/scripts/doc.php?function=AdjustColour

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Shadowfyr   USA  (1,774 posts)  [Biography] bio
Date Sat 07 Apr 2007 09:08 PM (UTC)  quote  ]
Message
Umm. Note, I think your example of "ESC[48;6;101m" will still set the color, but it would ignore the "blink: rapid" command in the middle. XTerms color implimenation actually only works because most implimentations allow "ESC[n[;k]m", but ignore cases of "ESC[n[;k][;k]...m" There is nothing in the spec specifically preventing that, but I don't think ANSI.SYS allowed it and I don't know of any other that did either. The page on wikipedia for it

http://en.wikipedia.org/wiki/ANSI_escape_code

gives a mess of totally unsupported codes, of which ANSI in most clients will probably only support the same subset as ANSI.SYS did. Its a throwback to when some applications required that to be installed for color support to work in text clients for DOS and BBSes. A lot of stuff in telnet game clients are throwbacks to those days.

main {
__if (Schrodinger_Cat is Alive or version >= "XP"){
____if version = "Vista" then Performance /= Number_of_Cores;
____call Functional_Code();}
__else
____call Crash_Windows();}
[Go to top] top

Posted by Shadowfyr   USA  (1,774 posts)  [Biography] bio
Date Sat 07 Apr 2007 08:55 PM (UTC)  quote  ]

Amended on Sat 07 Apr 2007 09:43 PM (UTC) by Nick Gammon

Message
Ack.. Too many things to reply to. Here we go... lol

Quote:
"... and the normal ANSI part at defaults (something Mushclient already violates. lol)"

In what way?


Mushclient violates the rule of not changing the base 16 ANSI colors because we "can" already edit them. ".pal" files generally have the first 16 and the last 8? as default settings, this was a convention from the old days where the applications had to use the same color palette as the OS, so if you changed the first 16 or the grey scale either a) Your the OS would replace the images first 16 and last 8 with its standards, messing up the picture, or in more unusual cases, the applications colors would get changed to match the image (which in some cases could be very bad). So, Mushclient is violating the rules by allowing you to change those colors.

This is however irrelevant, unless someone expects those colors to be defaults and your text gets messed up somehow because of it. But if that is the case, there is nothing to prevent you from changing back to the normal set.

Quote:
I am inclined to agree with Shaun here. It is all very well wanting 500 colours in the picker, but it then gets unwieldy.

It is very easy to choose a colour like "powderblue" and then adjust the RGB sliders to modify the colour slightly, or click "other colour" to open the standard Windows colour picker, and then move the luminance slider, if you want to change the brightness of it.


Umm. Thinking more in terms of the script. If you want "powderblue4", you can't tell it, "Use powderblue, but make it X% darker." You would have to return the actual RGB color for it, break that into its components, calculate the darker/lighter color, glue the conponents back together, then send that result to through the colornote command. One way to make it less unwieldy in the picker would be to just add a check box that would sort through the colors and only show the "main" set. I.e., anything that showed up as "powderblue(n)" would be tossed, giving the original list. And one of the most frustrating problems I had when looking for a color value was trying to remember what I used some place else. Sure, you can look through your code. Sure, you can look through the main world to see what you set an alternate color to, sure, you can "find" it, but it would be a lot easier to find if it either already had, or you could give it a name.

I remember, for example, that the "Brown" definition in POVRay never looked right, it was more red than it should have been. Maybe someone *wants* to use that color so would call it "MyBrown", just as about 90% of us added a "MyBrown" or "TrueBrown" definition to the file to fix it. (The original ran on the Commodore Amiga, and apparently something odd about the hardware meant that what we see as a correct brown color looked too green, so they had to originally make it more red to compensate.)

Quote:
Vim is a text editor which is Vi IMproved. The .vim files are colour schemes for the editor. The screenshot just above all the .vim files is a screenshot of someone using vim to edit some code.


Thanks. I did look at the files and did mention that I suspected this was the case. The page it was on wasn't, like most that assume you know what the files do already, too specific about that.

Quote:
* Show the entire (bad) sequence as regular text, making the assumption that it is really intended to be seen.

* Note the sequence is bad, but still hide it (ie. everything from ESC ... m), as it is clearly a control sequence, and not intended to be seen.

* Display as much as you can (eg. my earlier example of multiple codes, some of which are good and some are bad) - in other words, skipping (and not displaying) any bad codes in the middle.

* Process as much as you can, up to the bad code, and then ignore the rest.

* Process as much as you can, up to the bad code, and then display the rest.


In my experience, going clear back to BBSes, its more or less something between all 4. If something went screwy with a sequence like "esc[32;1;194mesc[45;0m" and you ended up with "[32;1mesc[45;qm" The result would be: "[32;1mm", since the second set would be seen, but do to the incorrect termination, processing ends the moment it hits the bad data, taking the offending invalid character with it. I think it ignores numbers though, so you could do something like esc[32;5;4;99;5;6m and it would just throw out the invalid values, but if a character landed in there some place, instead of a number, it would immediately terminate, usually only doing what that final character specified, so "m" sets a color, while "s" would "only" do what that character designates. The only source I have is, I think, is in ML for DOS3.3 or something and there is no telling if MS followed spec either. lol

main {
__if (Schrodinger_Cat is Alive or version >= "XP"){
____if version = "Vista" then Performance /= Number_of_Cores;
____call Functional_Code();}
__else
____call Crash_Windows();}
[Go to top] top

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Sat 07 Apr 2007 06:38 AM (UTC)  quote  ]
Message
Quote:

The most common way to handle bad data, in everything I have ever used that had ANSI support, is to just throw out any codes that are invalid.


Well, does this mean:


  • Show the entire (bad) sequence as regular text, making the assumption that it is really intended to be seen.

  • Note the sequence is bad, but still hide it (ie. everything from ESC ... m), as it is clearly a control sequence, and not intended to be seen.

  • Display as much as you can (eg. my earlier example of multiple codes, some of which are good and some are bad) - in other words, skipping (and not displaying) any bad codes in the middle.

  • Process as much as you can, up to the bad code, and then ignore the rest.

  • Process as much as you can, up to the bad code, and then display the rest.


I'm a bit opposed to regarding something like ESC[48;5;101m as "bad" just because you can't process it. To display that on the screen, when it is "obviously" a control sequence, is just going to make the screen look ugly.

So, for example, if I accept ESC[48;5;101m but one day get ESC[48;6;101m I am inclined to quietly drop it (not display it) on the grounds that it some new code I don't know about, but almost certainly not something intended for the player to see.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Sat 07 Apr 2007 06:23 AM (UTC)  quote  ]
Message
Quote:

... you would need a second "xTerm" color dialog off the one for changing ansi settings, which would bring up the palette you can edit for them all ...


I don't really see the point in editing all 256 colours. There are so many on offer that the transitions are really quite subtle (see colour swatches above). If you really want to remap them all, use the MapColour script function.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Sat 07 Apr 2007 06:11 AM (UTC)  quote  ]

Amended on Sat 07 Apr 2007 06:17 AM (UTC) by Nick Gammon

Message

These are the colour swatches generated with the current code (with 51 spacing as described above):

And, a smaller version without the reference numbers, which shows the colour transitions better:


- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Sat 07 Apr 2007 03:32 AM (UTC)  quote  ]
Message
Various pages (see below) seem to support the notion of a colour cube that has even increments of 51 (hex 0x33) for each element in the cube.

References:

http://world.std.com/~wij/color/
http://www.webreference.com/dev/graphics/palette.html
http://www.help4web.net/webmaster/Color/ColorTables.html

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


11,518 views.

This is page 1, subject is 4 pages long: 1 2  3  4  [Next page]

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]