Git Product home page Git Product logo

pavelkastornyy / ansi4j Goto Github PK

View Code? Open in Web Editor NEW
22.0 2.0 1.0 324 KB

ANSI4J is a library that includes Java parser for processing text with ANSI escape codes (ISO/IEC 6429 control functions) and a CSS generator for styling the text.

License: Apache License 2.0

Java 100.00%
java escape-sequences escape-codes ecma-48 iso-6429 css-generator ansi-escape-codes ansi-escape-sequences ansi-escape ansi

ansi4j's People

Contributors

pavelkastornyy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

dzavalishin

ansi4j's Issues

Remove logging of parser absenсe

Currently when FunctionFinder finds some function for which developer hasn't provided parser (in ParserFactory) warn log message is created. I think it should be removed because developer knows what parsers he provided and therefore what functions we wants to parse.

To set colors in DefaultTextAttributeConfig.Builder palette indexes should be used

At the moment when TextAttributeConfig is created concrete colors are used:

      int fgColor = 0xffffff;
      int bgColor = 0x000000;
      attributeConfig = new DefaultTextAttributeConfig.Builder()
                    .defaultForegroundColor(fgColor)
                    .defaultBackgroundColor(bgColor)
                    .extraColorsEnabled(true)
                    .palette16(palette)
                    .build();

I think instead of these colors palette indexes should be used, as all colors come from the palette.

[Question] How do you use function fragments

I've been working on a terminal emulator using this library, and I'm a little confused as to how to actually use a FunctionFragment once you've obtained it. Text fragments seem simple enough, but a function fragment doesn't appear to offer any methods that help you understand what it is. Am I not doing this right?

while ((fragment = parser.parse()) != null) {
    if (fragment.getType() == FragmentType.FUNCTION) {
        FunctionFragment funcFragment = (FunctionFragment) fragment;
        // How to get function details?
    } else {
        writeText(fragment.getText());
    }
}

Rename FragmentParser to FragmentHandler

Currently we have different types of parsers and as a result API is not very clear. So, it is better to rename Fragment/Text/Function parsers to Fragment/Text/Function handlers.

Support Ansi code parsing for character streams.

I'm working on a mock terminal that supports Ansi. The problem is, it receives characters from a print stream, and therefore they can't be fed into the Ansi parser. Even if it needed to do some internal buffering, supporting this use-case would make your library much more powerful.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.