Skip to content

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]).

@Pieter12345 Pieter12345 force-pushed the rgb-ansi-color-support branch from 0b963c4 to 65554a2 Compare March 16, 2024 23:47
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