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

Support MC RGB colors in conversion to ANSI color codes #1373

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Pieter12345
Copy link
Contributor

This adds conversion from MC RGB colors to ANSI color codes. The catch is that Windows command prompt does not show these colors, so it might still make sense to convert these to the nearest available ANSI colors. If you use Linux or Mac OS, could you test whether RGB color codes now work in cmdline mode and leave a comment with the result? Thanks!

@PseudoKnight
Copy link
Contributor

You're using a non-capturing parentheses group, so we get this:

java.lang.IndexOutOfBoundsException: No group 2
        at java.base/java.util.regex.Matcher.group(Matcher.java:646)
        at com.laytonsmith.core.Static.lambda$MCToANSIColors$0(Static.java:1188)
        at java.base/java.util.regex.Matcher.replaceAll(Matcher.java:1256)
        at com.laytonsmith.core.Static.MCToANSIColors(Static.java:1187)

@Pieter12345
Copy link
Contributor Author

You're using a non-capturing parentheses group, so we get this:

java.lang.IndexOutOfBoundsException: No group 2
        at java.base/java.util.regex.Matcher.group(Matcher.java:646)
        at com.laytonsmith.core.Static.lambda$MCToANSIColors$0(Static.java:1188)
        at java.base/java.util.regex.Matcher.replaceAll(Matcher.java:1256)
        at com.laytonsmith.core.Static.MCToANSIColors(Static.java:1187)

I'm not using a non-capturing parenthesis group (see inner part of (?i)§x(?:§([a-f0-9])){6}), but it appears that it only matches the last out of the 6 matches. I will explode it into (?i)§x§([a-f0-9])§([a-f0-9])§([a-f0-9])§([a-f0-9])§([a-f0-9])§([a-f0-9]).

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

Successfully merging this pull request may close these issues.

2 participants