Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translate IRC colours to in-game #13

Closed
qreeves opened this issue Feb 5, 2015 · 3 comments
Closed

Translate IRC colours to in-game #13

qreeves opened this issue Feb 5, 2015 · 3 comments

Comments

@qreeves
Copy link
Member

qreeves commented Feb 5, 2015

From: http://redeclipse.net/forum/viewtopic.php?f=9&t=460

Since Red Eclipse already translates in-game colors to IRC colors, as per a var in the servinit.cfg, I would very much like to see the reverse as well. That way, color codes are not shown in irc-to-game output.

@ZeroKnight
Copy link
Member

I could be unclear on exactly what the request is, but IRC->Cube color codes already work, albeit not entirely as they should. This line shows that all it does is find any EOT escapes (\x03 / ^C) that IRC clients use as the start of a "color code" and converts it to a FF (\f), which is the Cube Engine equivalent.

However, the colors that each number in the color escape sequence represents may not match the ones that Cube uses depending on the IRC client. This is because the IRC protocol does not in itself support color codes and is a feature implemented by the IRC client, thus the color mappings may vary, or not exist at all. Most clients that I know of conform to mIRC color codes.

There are two problems with the current implementation:

  • Cube color codes will not match up with most (if not all) IRC clients
  • 2-digit IRC color codes will not work

Regarding the first point, examine the table below. What appears as say, Green in a message sent in IRC would appear as Red in-game, because the color code 3 is Green in IRC, but Red in Cube.

Code mIRC Cube
0 White Green
1 Black Blue
2 Blue Yellow
3 Green Red
4 Red Grey
5 Brown Magenta
6 Purple Orange
7 Orange White
8 Yellow Black
9 Light Green Cyan

Regarding the second problem, Cube only uses a single character to determine the color in the color escape sequence (not counting the use of brackets), where IRC color codes can use 2 digits. Consider the following message, sent by a user in IRC:

^C13this message is in pink!

In IRC, it would display: this message is in pink!, in pink/magenta as intended. However, in game chat you would see: 3this message is in pink! in Blue. Notice the 3 at the beginning?

irc-color-demo1

This is because only the 1 in 13 is a part of the Cube color escape sequence; the 3 is left as a part of the regular text and it is rendered Blue.

This could be fixed by applying the reverse of what converttext() does to deal with color escapes to ircrecv(). I can work out a patch to do just this. 😃

@ZeroKnight
Copy link
Member

Well, I've got working code at the moment, just need to make sure it melds well with the rest of the code and I'm not missing any bugs

ZeroKnight added a commit to ZeroKnight/base that referenced this issue Feb 13, 2015
- Conforms to mIRC color codes, so most IRC clients should support them
  correctly.
- Normal, white colored Game->IRC text is no longer sent as pure black, but
  simply with no color code so IRC clients will use their default color. This
  prevents relayed game text being unreadable in IRC clients with dark
  backgrounds.
ZeroKnight added a commit to ZeroKnight/base that referenced this issue Feb 13, 2015
- Conforms to mIRC color codes, so most IRC clients should support them
  correctly.
- Normal, white colored Game->IRC text is no longer sent as pure black, but
  simply with no color code so IRC clients will use their default color. This
  prevents relayed game text being unreadable in IRC clients with dark
  backgrounds.
qreeves added a commit that referenced this issue Feb 13, 2015
Fix/Enhance IRC Relay colors. Fixes issue #13
@qreeves
Copy link
Member Author

qreeves commented Feb 13, 2015

Fixed by #47

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants