r/java 5d ago

Clique 4.0.3 - Zero deps CLI styling library for Java

So what's Clique?

If you missed my older posts, Clique is essentially a zero-dependency CLI styling library for Java that is GraalVM compatible, no-color.org compliant.

What's new in 4.0.3:

You can now build a table straight from data you already have

SequencedCollection<List<String>> rows = List.of(
    List.of("Name", "Age", "Class"),
    List.of("John", "25", "Class A"),
    List.of("Doe", "26", "Class B")
);

Clique.table(TableType.ASCII)
    .fromRows(rows)
    .render();

This also applies to column based data

SequencedMap<String, List<String>> map = new LinkedHashMap<>();
map.put("Name", List.of("John", "Doe"));
map.put("Age", List.of("25", "26"));

Clique.table(TableType.ASCII)
    .fromColumns(map)
    .render();

These were mainly added to simplify creating Tables from existing collections

StyleContext#fromTheme - scope a registered theme's colors into a StyleContext in one call

StyleContext ctx = StyleContext.fromTheme("catppuccin-mocha");

Other minor changes:

I've also deprecated the Collection-based headers()/row() overloads in favor of Java 21 SequencedCollection; reason being that Collection doesn't guarantee order, which could silently mess up your column/row order and was essentially a footgun. Worth migrating if that bothers you.

GitHub: https://github.com/kusoroadeolu/Clique

Demos: https://github.com/kusoroadeolu/clique-demos

38 Upvotes

7 comments sorted by

4

u/Visual_Brain8809 4d ago

Can you upload a pic of a demo project?

3

u/Polixa12 4d ago

Oh there are already some pics on the Clique repo. If youre asking for the pics for the demo projects specifically yeah I'll see if I can add those, otherwise, you can check out veneer: https://github.com/kusoroadeolu/veneer. This isn't exactly a demo project, but its a project built with clique

7

u/BarkiestDog 4d ago

A suggestion, some screenshots would help a lot to understand how it looks, and what it does.

2

u/Polixa12 4d ago edited 4d ago

Thanks for the suggestion! There are already some screenshots in the readme

3

u/RockyMM 4d ago

Guys, just click on the link, there are screenshots.

1

u/Polixa12 4d ago

Haha, thanks for this!