adventure icon indicating copy to clipboard operation
adventure copied to clipboard

Feature - AnsiComponentSerializer

Open Narimm opened this issue 5 years ago • 6 comments

Creates a serializer that can turn components into ansi formatted text.

note deserialization simply strips… escape codes and returns plain text.

Narimm avatar Aug 17 '20 04:08 Narimm

I have made the changes you requires however its failing checkstyle on the enum class with a public method getAnsi() I am not sure what format for methods it wants...from the checkstly it looks like it wants getANSI()

Narimm avatar Aug 17 '20 12:08 Narimm

I have rebased the branch on the latest 4.x master and done all the Javadocs for this one.

Narimm avatar Oct 06 '20 04:10 Narimm

It would be good to implement some colour detection strategies from https://gist.github.com/XVilka/8346728 if it's possible to do without a hard dependency on JLine -- maybe some method like:

enum ColorSupport { TRUE, LIMITED_256, LIMITED_16 }

public static ColorSupport colorLevel(final Consumer<String> output, final Supplier<String> input) {
  // [...]
}

zml2008 avatar Jan 01 '21 17:01 zml2008

Rebased and applied requested changes

Narimm avatar Jan 03 '21 13:01 Narimm

It would be good to implement some colour detection strategies from https://gist.github.com/XVilka/8346728 if it's possible to do without a hard dependency on JLine -- maybe some method like:

enum ColorSupport { TRUE, LIMITED_256, LIMITED_16 }

public static ColorSupport colorLevel(final Consumer<String> output, final Supplier<String> input) {
  // [...]
}

My understanding of this is the presence of the SYSTEM environment setting is highly inconsistent but MOST terminals will handle the escape codes for colours they cant portray by either dithering them or ignoring them and stripping them. I checked a couple and I didn't see the variable mentioned in that GIST

Narimm avatar Jan 14 '21 08:01 Narimm

to keep the info in one place, I'm planning on breaking this into two parts: a small shim in adventure itself, and an ansi serializer detached from any particular object model at https://github.com/KyoriPowered/ansi. unfortunately time's been limited so this PR hasn't seen much activity, hoping to get back to it sometime. i can push my WIP on the adventure side if anyone else is interested in picking it up.

zml2008 avatar May 31 '21 03:05 zml2008