The Rebelion
Profile :: Search :: Memberlist :: Usergroups :: Register
Your Posts :: Log in to check your private messages :: Log in
Post new topic   Reply to topic    The Rebelion Forum Index -> Documentation -> Color Codes
View previous topic :: View next topic  
Author Message
Elite Member

Joined: 20 Jan 2006
Posts: 571

Location: Pandora

PostPosted: Sat Jun 02, 2012 2:12 am    Post subject: Color Codes  Reply with quote

    1. Introduction
    I have come across several discussions concerning the WinMX color code format. This thread will explain both in-line and human-readable formats and when they should be used.

    2. Human-Readable Color Format
    This is the color format most WinMX users are aware of. The standard format is #c0# where 0 is a valid WinMX color code. This format is primarily sent by Chat Clients. When sending a General Text packet, the user (or the client software) may use several of these color codes to color portions of the message.

      "#c57#abc" would display as abc

    If a client is in "bot mode", the server will send all messages using this color format. If any client sends a message to the server containing color codes, the message is passed on as-is to "bot mode" clients. Client software should be able to handle both types of color formats to ensure maximum compatibility.

    Color codes should only be sent to a server that has indicated WPNP 3.53 support. A WPNP 3.31 server will most likely ignore your color codes. Some servers offer options that will remove colors from messages. Some servers have additional color features that are not standardized, and as such, are beyond the scope of the document.

    3. In-Line Color Format
    The in-line color format is used by servers to send messages back to clients. The format for in-line color codes is {3, 0} where 3 and 0 are Bytes and 0 is a valid WinMX color code. It is relatively simple to write code to detect this format. Search your Byte array for a 3, the next byte will contain your WinMX color code.

      {3, 57, 97, 98, 99} would display as abc

    Servers should not send color codes to clients that have not indicated support for WPNP 3.53 or clients in "bot mode". Servers should not send color codes in the human-readable format unless they intend to display it to the clients. Zero (0) should never be used for an in-line color code since zero is also the null-termination character.

    You can send a list of human-readable codes to a client (a color menu) by using the corresponding in-line color code before the human-readable code. Clients should only parse the in-line code, coloring the human-readable code.

    3. Random Colors
    A common feature of many 3rd party servers is a color code that produces a random color. A client should send the human-readable code #c?# (or #cx# on some older servers) instead of selecting a color code. When a server receives a message with a random color code, it should select a random (valid) color code and send it back to clients using the in-line format. Some servers may not support this feature.

    4. Valid WinMX Color Codes List
    This is a list of color codes defined by FrontCode and generally accepted as the official color palette. Since a Byte value can range from 0 to 255, there are hundreds of undefined codes. The codes are listed with their RGBA value within a VB.NET Select statement. If you are not using VB.NET, only the actual RGBA value is relevant to you.

      Select Case code
      Case 1 : Return Color.FromArgb(-1)
      Case 2 : Return Color.FromArgb(-256)
      Case 3 : Return Color.FromArgb(-65281)
      Case 4 : Return Color.FromArgb(-8323328)
      Case 5 : Return Color.FromArgb(-32640)
      Case 6 : Return Color.FromArgb(-8323073)
      Case 7 : Return Color.FromArgb(-16776961)
      Case 8 : Return Color.FromArgb(-65536)
      Case 9 : Return Color.FromArgb(-8421505)
      Case 10 : Return Color.FromArgb(-16744193)
      Case 11 : Return Color.FromArgb(-16711681)
      Case 12 : Return Color.FromArgb(-16711808)
      Case 13 : Return Color.FromArgb(-16711936)
      Case 14 : Return Color.FromArgb(-8323328)
      Case 15 : Return Color.FromArgb(-256)
      Case 16 : Return Color.FromArgb(-32768)
      Case 17 : Return Color.FromArgb(-65536)
      Case 18 : Return Color.FromArgb(-65408)
      Case 19 : Return Color.FromArgb(-65281)
      Case 20 : Return Color.FromArgb(-8388353)
      Case 21 : Return Color.FromArgb(-4144960)
      Case 22 : Return Color.FromArgb(-12566464)
      Case 23 : Return Color.FromArgb(-16777088)
      Case 24 : Return Color.FromArgb(-16760704)
      Case 25 : Return Color.FromArgb(-16744320)
      Case 26 : Return Color.FromArgb(-16744384)
      Case 27 : Return Color.FromArgb(-16744448)
      Case 28 : Return Color.FromArgb(-12550144)
      Case 29 : Return Color.FromArgb(-8355840)
      Case 30 : Return Color.FromArgb(-8372224)
      Case 31 : Return Color.FromArgb(-8388608)
      Case 32 : Return Color.FromArgb(-8388544)
      Case 33 : Return Color.FromArgb(-8388480)
      Case 34 : Return Color.FromArgb(-12582784)
      Case 35 : Return Color.FromArgb(-657931)
      Case 36 : Return Color.FromArgb(-657931)
      Case 37 : Return Color.FromArgb(-657931)
      Case 38 : Return Color.FromArgb(-657931)
      Case 39 : Return Color.FromArgb(-657931)
      Case 40 : Return Color.FromArgb(-657931)
      Case 41 : Return Color.FromArgb(-657931)
      Case 42 : Return Color.FromArgb(-657931)
      Case 43 : Return Color.FromArgb(-657931)
      Case 44 : Return Color.FromArgb(-657931)
      Case 45 : Return Color.FromArgb(-657931)
      Case 46 : Return Color.FromArgb(-657931)
      Case 47 : Return Color.FromArgb(-657931)
      Case 48 : Return Color.FromArgb(-657931)
      Case 50 : Return Color.FromArgb(-657931)
      Case 51 : Return Color.FromArgb(-16744193)
      Case 52 : Return Color.FromArgb(-16711681)
      Case 53 : Return Color.FromArgb(-16711808)
      Case 54 : Return Color.FromArgb(-16711936)
      Case 55 : Return Color.FromArgb(-8323328)
      Case 56 : Return Color.FromArgb(-256)
      Case 57 : Return Color.FromArgb(-32768)
      Case 58 : Return Color.FromArgb(-65536)
      Case 59 : Return Color.FromArgb(-65408)
      Case 60 : Return Color.FromArgb(-65281)
      Case 61 : Return Color.FromArgb(-8388353)
      Case 62 : Return Color.FromArgb(-4144960)
      Case 63 : Return Color.FromArgb(-12566464)
      Case 64 : Return Color.FromArgb(-16777088)
      Case 65 : Return Color.FromArgb(-16760704)
      Case 66 : Return Color.FromArgb(-16744320)
      Case 67 : Return Color.FromArgb(-16744384)
      Case 68 : Return Color.FromArgb(-16744448)
      Case 69 : Return Color.FromArgb(-12550144)
      Case 70 : Return Color.FromArgb(-8355840)
      Case 71 : Return Color.FromArgb(-8372224)
      Case 72 : Return Color.FromArgb(-8388608)
      Case 73 : Return Color.FromArgb(-8388544)
      Case 74 : Return Color.FromArgb(-8388480)
      Case 75 : Return Color.FromArgb(-12582784)
      End Select

    The other list I wanted to include is a list of codes that represent all of the unique colors available. You could use these to generate a color menu for your client or server.

      {1, 50, 62, 9, 63, 49, 8, 5, 57, 2, 12, 4, 14, 13, 69, 68, 27, 67, 70, 6, 11, 10, 65, 7, 64, 3, 18, 61, 33, 34}

Mato | Chat.Net Beta + Stable | RWCS
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    The Rebelion Forum Index -> Documentation

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
Create your own free forum | Buy a domain to use with your forum