Feature - AnsiComponentSerializer
Creates a serializer that can turn components into ansi formatted text.
note deserialization simply strips… escape codes and returns plain text.
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()
I have rebased the branch on the latest 4.x master and done all the Javadocs for this one.
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) {
// [...]
}
Rebased and applied requested changes
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
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.