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

Downsample RGB colors for viewers who can't see them #68

Closed
zml2008 opened this issue Jun 6, 2020 · 1 comment
Closed

Downsample RGB colors for viewers who can't see them #68

zml2008 opened this issue Jun 6, 2020 · 1 comment
Milestone

Comments

@zml2008
Copy link
Member

zml2008 commented Jun 6, 2020

With the latest Minecraft client, we can send texts in any RGB color, rather than the previous space of only 16.

Full color isn't supported by every viewer of our text -- commonly used console libraries convert to ANSI based on legacy color codes, and we target clients all the way back to MC 1.8.

When unsupported colors are passed to the legacy serializer, it fails locally with an exception.
When unsupported colors are sent to players, the color will be stripped entirely and players will see white text.

Users of the API could only avoid these issues by tracking the capabilities of every individual version they target, or by not using RGB at all.

I've added some API, currently on NamedTextColor, to find the nearest legacy color from any RGB color, but it is not yet used in any of the serializers. I'm also not entirely satisfied with the algorithm used -- it tends to favor the grays, as relatively "average" colors numerically.

How should the different serializers handle it?

@Electroid Electroid added this to the 4.0 milestone Jun 8, 2020
@Electroid
Copy link
Member

This is done.

zml2008 pushed a commit that referenced this issue Dec 7, 2021
Signed-off-by: MiniDigger <admin@minidigger.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants