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/color #21

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open

Feature/color #21

wants to merge 3 commits into from

Conversation

andy176631
Copy link

@andy176631 andy176631 commented Dec 23, 2017

Hi all,
I developed a feature that providing table with color output. It allow to assign the color/attribute for the text in each cell. What I mainly add to project are:

  1. Color/attribute class in skb-java-interface
  2. Generate a color configuration table in ascciitable
  3. In ascii-utf-themes, append ANSI code to the text at last step before frame transfers to array of string.

Usage example:

  final AsciiTable at = new AsciiTable();    
  at.addRule();		
  AT_Row r0 = at.addRow("c_0_0","c_0_1", "c_0_2");
  r0.getCells().get(0).getContext().setTextFgColor(FgColor.GREEN);
  r0.getCells().get(1).getContext().setTextBgColor(BgColor.GREEN);
  r0.getCells().get(2).getContext().setTextAttribute(Attribute.BOLD);
  at.addRule();	 
  AT_Row r1 = at.addRow("c_1_0", "c_1_1", "c_1_2");
  r1.getCells().get(0).getContext().setTextFgColor(FgColor.RED);
  r1.getCells().get(2).getContext().setTextBgColor(BgColor.RED);
  at.addRule();
  at.setTextAlignment(TextAlignment.CENTER);	
  System.out.println(at.render());

Output:
2017-12-23 9 44 53

Pls refer to another PR:
vdmeer/skb-java-interfaces#1
vdmeer/ascii-utf-themes#2

@CloudNinja42
Copy link

I need this, please merge this :)

Is it easy to build this change for myself? I see there are PR across three projects..

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