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

Hex color messages are not displayed properly #2025

Closed
AnInternetTroll opened this issue Oct 2, 2023 · 15 comments
Closed

Hex color messages are not displayed properly #2025

AnInternetTroll opened this issue Oct 2, 2023 · 15 comments
Assignees
Labels
feature New feature request
Milestone

Comments

@AnInternetTroll
Copy link

Bug summary

Messages that use hex color codes do not display properly

Steps to reproduce and Current behavior

The message "***Does this look fancy***?" (using gitter.py) sent gets sent back as

FF00FF,FFFFFFDFF0000,FFFFFFoFFFF00,FFFFFFe00FC00,FFFFFFs00FFFF,FFFFFF0080FF,FFFFFFtFF00FF,FFFFFFhFF0000,FFFFFFiFFFF00,FFFFFFs00FC00,FFFFFF00FFFF,FFFFFFl0080FF,FFFFFFoFF00FF,FFFFFFoFF0000,FFFFFFkFFFF00,FFFFFF00FC00,FFFFFFf00FFFF,FFFFFFa0080FF,FFFFFFnFF00FF,FFFFFFcFF0000,FFFFFFy?

when using matrix2051, which decodes the following message

<font data-mx-color=\"#FF00FF\">D</font><font data-mx-color=\"#FF0000\">o</font><font data-mx-color=\"#FFFF00\">e</font><font data-mx-color=\"#00FC00\">s</font><font data-mx-color=\"#00FFFF\"> </font><font data-mx-color=\"#0080FF\">t</font><font data-mx-color=\"#FF00FF\">h</font><font data-mx-color=\"#FF0000\">i</font><font data-mx-color=\"#FFFF00\">s</font><font data-mx-color=\"#00FC00\"> </font><font data-mx-color=\"#00FFFF\">l</font><font data-mx-color=\"#0080FF\">o</font><font data-mx-color=\"#FF00FF\">o</font><font data-mx-color=\"#FF0000\">k</font><font data-mx-color=\"#FFFF00\"> </font><font data-mx-color=\"#00FC00\">f</font><font data-mx-color=\"#00FFFF\">a</font><font data-mx-color=\"#0080FF\">n</font><font data-mx-color=\"#FF00FF\">c</font><font data-mx-color=\"#FF0000\">y</font>?

Expected behavior

Colorful text

Additional information

I was told to link this
https://modern.ircdocs.horse/formatting#hex-color


  • WeeChat version: 4.0.5
  • OS, distribution and version: Void Linux
  • Terminal: foot 1.15.3
  • Terminal multiplexer (screen/tmux/…/none): none
@AnInternetTroll AnInternetTroll added the bug Unexpected problem or unintended behavior label Oct 2, 2023
@flashcode
Copy link
Member

Hi,

Hex color codes (code 0x04 in messages) is not supported, so for me it's not a bug, but a feature request. Or maybe you mean WeeChat should just ignore these codes and display properly without colors, as it's not supported?

If it's OK for you, I'll update the label accordingly and check how it can be implemented: it shouldn't be that hard, WeeChat has already functions to map hex color codes to internal colors.

@flashcode flashcode self-assigned this Oct 3, 2023
@flashcode flashcode added the waiting info Waiting for info from author of issue label Oct 3, 2023
@AnInternetTroll
Copy link
Author

AnInternetTroll commented Oct 3, 2023 via email

@flashcode flashcode added feature New feature request and removed waiting info Waiting for info from author of issue bug Unexpected problem or unintended behavior labels Oct 9, 2023
@flashcode flashcode added this to the 4.2.0 milestone Nov 1, 2023
flashcode added a commit that referenced this issue Nov 1, 2023
This is made using standard color code '\x04' followed by text color (RGB as
hexadecimal) and optional background (RGB as hexadecimal).
@flashcode
Copy link
Member

It's now implemented, your feedback is welcome, whether it works well or not!

@progval
Copy link
Contributor

progval commented Nov 1, 2023

works for me!

@AnInternetTroll
Copy link
Author

AnInternetTroll commented Nov 1, 2023 via email

@AnInternetTroll
Copy link
Author

Here is a screenshot
20231101-181808

Pressing the up arrow also gives me

C13sC4eC8cC9oC11nC12dC13 C4tC8eC9sC11tC
C13aC4 C8tC9eC11sC12tC13 C4wC8iC9tC11hC12 C13mC4aC8nC9yC11 C12mC13aC4nC8yC9 C11wC12oC13rC4dC8sC

Which when send output the same colorful text that was originally sent. Though that might just be glitter.py

@flashcode
Copy link
Member

If there is a light background in messages, that means the background color was forced.
It's weird because I just tested this script glitter.py and I have no white background.
Maybe another script is conflicting there?

Can you try with a default config and just the script glitter.py?

Anyway I think this problem is not related to the RGB color feature just added.

@flashcode
Copy link
Member

Also check your value of option /set irc.color.mirc_remap.

@AnInternetTroll
Copy link
Author

AnInternetTroll commented Nov 1, 2023 via email

@flashcode
Copy link
Member

Just moving .config/weechat is not enough (for example scripts are in another directory, so they'll be still loaded).

It's not even needed to move directories to test another config, you can run weechat -t (to use a temporary "home" directory, that is deleted on exit) or weechat -d /tmp/weechat to use another directory (not deleted on exit).

@AnInternetTroll
Copy link
Author

AnInternetTroll commented Nov 1, 2023 via email

@flashcode
Copy link
Member

I'm not able to reproduce, here's what I did, using my own IRC test server, running locally:

weechat -t
/set script.scripts.download_enabled on
/script install glitter.py
/server add local 127.0.0.1 -notls -autojoin=#test
/connect local

Then I send this text:

***a test with many words***

The result is:

image

@progval
Copy link
Contributor

progval commented Nov 1, 2023

Actually, I have a complaint: in Foot with TERM=xterm, in this message: :foo\x04FF0000bar\x0399,99\x047F0000baz\x0399,99, "bar" and "baz" are both shown the same red, even though \x04FF0000 and \x047F0000 should map exactly to \x0304 and \x0305 according to the values used in the CSS, which is the best authority I'm aware of

@flashcode
Copy link
Member

flashcode commented Nov 2, 2023

Actually, the color FF0000 is converted to terminal 9 (bright red) and 7F0000 is converted to terminal color 1 (dark red).

And if I try IRC colors 04 and 05 I have same result (there's a difference between both reds on this screenshot):

image

Note that RGB colors are directly mapped to terminal colors (0-255) and not IRC colors, so more colors can be used.

@progval
Copy link
Contributor

progval commented Nov 2, 2023

Ack, it must be my terminal then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature request
Projects
None yet
Development

No branches or pull requests

3 participants