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

Feature: allow dev to display color without printers #33

Closed
dialex opened this issue Dec 21, 2019 · 1 comment · Fixed by #49
Closed

Feature: allow dev to display color without printers #33

dialex opened this issue Dec 21, 2019 · 1 comment · Fixed by #49

Comments

@dialex
Copy link
Owner

dialex commented Dec 21, 2019

Just like Jansi, using system.out.println and passing the generated code from our Ansi class, the dev should be able to print color without our printers. This is less prescriptive.

// (this is pseudocode)

Ansi.Attribute.RED_TEXT
Ansi.Attribute.YELLOW_BACK
Ansi.Attribute.BRIGHT


// option 1: simple format
AnsiFormat fError = new AnsiFormat(Attribute.RED_TEXT);
System.out.println(fError.format("This text will be red"));

// option 2: composite format
AnsiFormat fWarning = new AnsiFormat(Attribute.RED_TEXT, Attribute.YELLOW_BACK, Attribute.BRIGHT);
System.out.println(fWarning.format("This text will be bright red with yellow background"));

// option 3: inline format
System.out.println(Ansi.colorize("This text will be cyan", Attribute.CYAN_TEXT));


AnsiFormat.format("message") -> calls Ansi.colorize() with internal state
Ansi.colorize("message", Ansi.Attribute[1 or more]) -> String with AnsiCodes, ready for Sys.out
Ansi.makeItFabulous() -> alias to .colorize()
@dialex dialex added this to the v4.* milestone Dec 21, 2019
@dialex
Copy link
Owner Author

dialex commented Dec 26, 2019

This should be a side-effect of #28

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