• Prime Mover (unregistered)

    You could always implement a long-term corporate strategy:

    "Any color you like, as long as it's purple."

  • Maia Everett (github)
    Case Else
        Return Color.FromArgb(Int32.Parse(strColor))
    

    Fixed?

  • WTFGuy (unregistered)

    I'm going to bet that version 1 of this whole thing was pre .NET.

    Then one or both ends were ported to .NET separately and what we are seeing is nothing but homebrew "wire serialization" from an era when homebrew was the only kind there was. The shame is back then they could have done both ends together more smartly. Instead they just left this to fester, and because of copypasta, to proliferate.

    I especially like that "unrecognized" maps to white on the server and to purple on the client. That's in addition to the gaps between their two mostly-overlapping sets of recognized colors.

    I bet a truly diligent search of the codebase would find a few (a lot?) of different versions of each, with slightly different color gamuts in each. Such fun.

  • AnonToday (unregistered)

    So, the first oddity is that the colo(u)rs are BGR, rather than the more typical RGB.

    Then there's the fact that "Light Gray" is darker than "Dark Gray".

    Then there's the question as to why the GetColor function starts to be concerned with 32-bit values rather than 24 bit values (e.g. 0x80_00_00_0F). [N.B. Underscores simply added to clarify the number of specified bytes.]

    Then there's Light Gray being 2 different colo(u)r code - 0x80_00_00_0F (hex or -2147483633), or 0x80_80_80. Also, Orange is both 0x80C0FF and 0xFFFF (i.e. 65535).

    Also, what is with the trailing ampersand on some of the hex values?

    And this is ignoring the issue that these values are all strings, rather than numbers.

  • Patrick (unregistered)

    Forgive me, but I'm a bit slow in understanding why this is a WTF. The codes seem to correspond to each other, so that can't be it Or is the WTF that - for example - value 256 is used for red, when 256 is not the RGB code for red?

  • (nodebb) in reply to AnonToday

    And this is ignoring the issue that these values are all strings, rather than numbers.

    Once they are just treated as strings, the other oddities are just noise. 'Cept maybe two different values for Light Grey.

  • Heinebold (unregistered)

    Return Color.Orange Return Color.Orange 'bright yellow

  • Tinkle (unregistered) in reply to AnonToday

    Those will be the windows system colours. For example &H80000005 is the window client background colour.

    The format these numbers are in looks like VB6 hexadecimal, although I am sure there will be other versions of BASIC that do similar things.

  • Officer Johnny Holzkopf (unregistered) in reply to Tinkle

    The &H notation for hex values was present already in QBasic. It's quite possible that this tradition was kept in all following BASIC languages for PC?

  • Jan (unregistered) in reply to Patrick

    The client doesn't look at numbers but strings.

  • (nodebb)

    What is not accounted for is that the original programmer(s) worked VERY fast, therefore they were impacted by relativity induced color shifts....

  • ooOOooGa (unregistered) in reply to Patrick
    1. It only allows a very small set of colors. Any other color that you attempt to use will result in an error code and one of two default colors used.

    2. The colors supported don't actually match completely. The client can interpret more color codes than the server will send.

    3. It is passing the data using "numbers" - number as string.

    4. All of the above problems could be fixed by using any one of the standard color encoding schemes. One library function call to encode the color and one library function call to decode the color. The in-house development team won't have to maintain those functions, they will work on both sides for all colors, and it will pass the data in a standardized format.

  • Old timer (unregistered) in reply to Officer Johnny Holzkopf
    Comment held for moderation.
  • techgrama (unregistered)
    Comment held for moderation.
  • cooldumpmovie (unregistered)
    Comment held for moderation.

Leave a comment on “Classic WTF: Color Me Stupid”

Log In or post as a guest

Replying to comment #:

« Return to Article