Top Description Constructors Methods
io.github.kusoroadeolu.clique

public final Class Clique

extends Object
Class Inheritance
Annotations
@Stable
since:3.2.0
Imports
io.github.kusoroadeolu.clique.components.*, io.github.kusoroadeolu.clique.configuration.*, io.github.kusoroadeolu.clique.internal.documentation.Stable, io.github.kusoroadeolu.clique.internal.utils.AnsiDetector, io.github.kusoroadeolu.clique.parser.MarkupParser, io.github.kusoroadeolu.clique.spi.AnsiCode, .CliqueTheme, .RGBAnsiCode, io.github.kusoroadeolu.clique.style.Ink, .StyleBuilder, java.util.Collection, .List, .Map, .Optional

Main facade for the Clique library.

Clique provides static factory methods for all library components. This is the primary entry point for interacting with Clique.

Example usage:

Clique.parser().print("[red, bold]Error:[/] Something went wrong");

Clique.table()
    .headers("Name", "Age")
    .row("Alice", "25")
    .render();
Since
1.0.0

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static Box

Returns:

a new Box instance
box
()

Creates a Box with the BoxType#ROUNDED type and BoxConfiguration#DEFAULT configuration.

public static Box

Returns:

a new Box instance
box
(BoxConfiguration
the box configuration to use
configuration
)

Creates a Box with the given configuration.

public static Box

Returns:

a new Box instance
box
(BoxType
the box type to use
type
,
BoxConfiguration
the box configuration to use
configuration
)

Creates a Box with the given type and configuration.

public static Box

Returns:

a new Box instance
box
(BoxType
the box type to use
type
)

Creates a Box with the given type and BoxConfiguration#DEFAULT configuration.

public static Box

Returns:

a new Box instance
box
(BoxType
the box type to use
type
,
AnsiCode...
one or more ANSI codes to apply to the border
borderColor
)

Creates a Box with the given type and border color.

public static Box

Returns:

a new Box instance
box
(AnsiCode...
one or more ANSI codes to apply to the border
borderColor
)

Creates a Box with the given border color.

public static Box

Returns:

a new Box instance
box
(BoxType
the box type to use
type
,
String
the name of a registered color to apply to the border
borderColor
)

Creates a Box with the given type and a named border color.

public static Box

Returns:

a new Box instance
box
(String
the name of a registered color to apply to the border
borderColor
)

Creates a Box with a named border color.

public static AnsiCode

Returns:

a new composite AnsiCode
compose
(AnsiCode...
the codes to compose; must not be null
ansiCodes
)

Creates a composite AnsiCode that combines multiple AnsiCode instances into a single sequence applied left to right.

public static AnsiCode

Returns:

a new composite AnsiCode
compose
(Collection<AnsiCode>
the codes to compose; must not be null
ansiCodes
)

Creates a composite AnsiCode that combines a collection of AnsiCode instances into a single sequence applied in iteration order.

public static void
disableCliqueColors()

Disables ANSI color output globally for all Clique components.

public static Divider

Returns:

a new Divider instance
divider
(int
the width of the divider.
width
)

Creates a Divider with a given width.

public static Divider

Returns:

a new Divider instance
divider
(int
the width of the divider
width
,
String
the color of the divider
color
)

Creates a Divider with a given width and color.

public static Divider

Returns:

a new Divider instance
divider
(int
the width of the divider
width
,
AnsiCode...
the color of the divider
color
)

Creates a Divider with a given width and color.

public static Divider

Returns:

a new Divider instance
divider
(int
the width of the divider
width
,
DividerConfiguration
the divider configuration to use
config
)

Creates a Divider with a given width and configuration.

public static void
enableCliqueColors()

Enables ANSI color output globally for all Clique components.

public static List<CliqueTheme>

Returns:

a list of available themes
findAvailableThemes
()

Returns a list of all CliqueTheme instances discoverable on the classpath.

public static Optional<CliqueTheme>

Returns:

an Optional containing the theme if found, or empty if not
findTheme
(String
the name of the theme to look up
themeName
)

Finds a registered theme by name.

public static Frame

Returns:

a new Frame instance
frame
()

Creates a Frame with the BoxType#ROUNDED type and FrameConfiguration#DEFAULT configuration.

public static Frame

Returns:

a new Frame instance
frame
(FrameConfiguration
the frame configuration to use
configuration
)

Creates a Frame with the BoxType#ROUNDED type and the given configuration.

public static Frame

Returns:

a new Frame instance
frame
(BoxType
the box type to use for the frame border
type
)

Creates a Frame with the given box type and FrameConfiguration#DEFAULT configuration.

public static Frame

Returns:

a new Frame instance
frame
(BoxType
the box type to use for the frame border
type
,
FrameConfiguration
the frame configuration to use
configuration
)

Creates a Frame with the given box type and configuration.

public static Frame

Returns:

a new Frame instance
frame
(BoxType
the box type to use for the frame border
type
,
AnsiCode...
one or more ANSI codes to apply to the border
borderColor
)

Creates a Frame with the given box type and border color.

public static Frame

Returns:

a new Frame instance
frame
(AnsiCode...
one or more ANSI codes to apply to the border
borderColor
)

Creates a Frame with the BoxType#ROUNDED type and given border color.

public static Frame

Returns:

a new Frame instance
frame
(BoxType
the box type to use for the frame border
type
,
String
the name of a registered color to apply to the border
borderColor
)

Creates a Frame with the given box type and a named border color.

public static Frame

Returns:

a new Frame instance
frame
(String
the name of a registered color to apply to the border
borderColor
)

Creates a Frame with the BoxType#ROUNDED type and named border color.

public static RGBAnsiCode

Returns:

a new RGBAnsiCode
hex
(String
the hex color string; must not be null and must be in #RRGGBB format
hexCode
)

Applies a 24-bit RGB foreground color via a #RRGGBB hex string.

public static RGBAnsiCode

Returns:

a new RGBAnsiCode
hex
(String
the hex color string; must not be null and must be in #RRGGBB format
hexCode
,
boolean
true to apply as a background color, false for foreground
background
)

Applies a 24-bit RGB color via a #RRGGBB hex string, optionally to the background.

public static Ink

Returns:

a new Ink instance
ink
()

Creates a new Ink instance.

public static Ink

Returns:

a new Ink instance
ink
(StyleContext
the style context to apply
context
)

Creates a new Ink instance with the given StyleContext.

public static ItemList

Returns:

a new ItemList instance
list
()

Creates an ItemList with the ItemListConfiguration#DEFAULT configuration.

public static ItemList

Returns:

a new ItemList instance
list
(ItemListConfiguration
the item list configuration to use
itemListConfiguration
)

Creates an ItemList with the given configuration.

public static MarkupParser

Returns:

a new MarkupParser instance
parser
()

Creates a MarkupParser with default configuration.

public static MarkupParser

Returns:

a new MarkupParser instance
parser
(ParserConfiguration
the parser configuration to use
configuration
)

Creates a MarkupParser with the given configuration.

public static ProgressBar

Returns:

a new ProgressBar instance
progressBar
(int
the total number of ticks to completion
total
)

Creates a ProgressBar with the given total and ProgressBarConfiguration#DEFAULT configuration.

public static ProgressBar

Returns:

a new ProgressBar instance
progressBar
(int
the total number of ticks to completion
total
,
ProgressBarConfiguration
the progress bar configuration to use
configuration
)

Creates a ProgressBar with the given total and configuration.

public static ProgressBar
progressBar(int
the total number of ticks to completion
total
,
ProgressBarPreset
the predefined style preset to use
preset
)

Creates a ProgressBar with the given total and preset style.

public static ProgressBar
progressBar(int
the total number of ticks to completion
total
,
EasingConfiguration
the easing configuration to apply to the animation
easing
)

Creates a ProgressBar with the given total and easing configuration.

public static <
the type of elements in the collection
T
>
IterableProgressBar<T>

Returns:

a new IterableProgressBar instance
progressBar
(Collection<T>
the collection to iterate over
collection
)

Creates an IterableProgressBar from the given collection and ProgressBarConfiguration#DEFAULT configuration.

public static <
the type of elements in the collection
T
>
IterableProgressBar<T>

Returns:

a new IterableProgressBar instance
progressBar
(Collection<T>
the collection to iterate over
collection
,
ProgressBarConfiguration
the progress bar configuration to use
configuration
)

Creates an IterableProgressBar from the given collection with a custom configuration.

public static <
the type of elements in the collection
T
>
IterableProgressBar<T>

Returns:

a new IterableProgressBar instance
progressBar
(Collection<T>
the collection to iterate over
collection
,
ProgressBarPreset preset)

Creates an IterableProgressBar from the given collection with a preset style.

public static void
registerAvailableThemes()

Registers all themes discoverable on the classpath via the CliqueTheme SPI.

public static void
registerStyle(String
the name to register the style under
style
,
AnsiCode
the ANSI code to associate with the name
code
)

Registers a single custom style that can be referenced by name in markup.

public static void
registerStyles(Map<String, AnsiCode>
a map of style names to their corresponding AnsiCode values
codes
)

Registers multiple custom styles from a map of names to ANSI codes.

public static void
registerTheme(String
the name of the theme to register
themeName
)

Registers a theme by name, making its color tokens available in markup.

public static void
registerTheme(CliqueTheme
the theme to register
theme
)

Registers a CliqueTheme instance directly.

public static void
registerThemes(String...
the names of the themes to register
themeNames
)

Registers multiple themes by name.

public static void
registerThemes(Collection<String>
a collection of theme names to register
themes
)

Registers multiple themes from a collection of names.

public static RGBAnsiCode

Returns:

a new RGBAnsiCode for the foreground
rgb
(int
the red component (0–255)
r
,
int
the green component (0–255)
g
,
int
the blue component (0–255)
b
)

Creates an RGB foreground color.

public static RGBAnsiCode

Returns:

a new RGBAnsiCode
rgb
(int
the red component (0–255)
r
,
int
the green component (0–255)
g
,
int
the blue component (0–255)
b
,
boolean
true to apply as a background color, false for foreground
background
)

Creates an RGB color, optionally applied to the background.

public static StyleBuilder

Returns:

a new StyleBuilder instance
styleBuilder
()

Creates a new StyleBuilder for fluently composing styled strings.

public static PendingTable

Returns:

a new PendingTable instance
table
()

Creates a PendingTable with the TableType#BOX_DRAW type and TableConfiguration#DEFAULT.

public static PendingTable

Returns:

a new PendingTable instance
table
(TableConfiguration
the table configuration to use
configuration
)

Creates a PendingTable with the TableType#BOX_DRAW type and given configuration.

public static PendingTable

Returns:

a new PendingTable instance
table
(TableType
the table type to use
type
)

Creates a PendingTable with the given type.

public static PendingTable

Returns:

a new PendingTable instance
table
(TableType
the table type to use
type
,
TableConfiguration
the table configuration to use
configuration
)

Creates a PendingTable with the given type and configuration.

public static PendingTable

Returns:

a new PendingTable instance
table
(TableType
the table type to use
type
,
AnsiCode...
one or more ANSI codes to apply to the border
borderColor
)

Creates a PendingTable with the given type and border color.

public static PendingTable

Returns:

a new PendingTable instance
table
(AnsiCode...
one or more ANSI codes to apply to the border
borderColor
)

Creates a PendingTable with the TableType#BOX_DRAW type and given border color.

public static PendingTable

Returns:

a new PendingTable instance
table
(TableType
the table type to use
type
,
String
the name of a registered color to apply to the border
borderColor
)

Creates a PendingTable with the given type and a named border color.

public static PendingTable

Returns:

a new PendingTable instance
table
(String
the name of a registered color to apply to the border
borderColor
)

Creates a PendingTable with the TableType#BOX_DRAW type and a named border color.

public static Tree

Returns:

a new Tree instance
tree
(String
the label for the root node
label
)

Creates a Tree with the given root label and TreeConfiguration#DEFAULT configuration.

public static Tree

Returns:

a new Tree instance
tree
(String
the label for the root node
label
,
TreeConfiguration
the tree configuration to use
configuration
)

Creates a Tree with the given root label and configuration.

public static Tree

Returns:

a new Tree instance
tree
(String
the label for the root node
label
,
String
the name of a registered color to apply to connectors
connectorColor
)

Creates a Tree with the given root label and a named connector color.

public static Tree

Returns:

a new Tree instance
tree
(String
the label for the root node
label
,
AnsiCode...
one or more ANSI codes to apply to connectors
connectorColor
)

Creates a Tree with the given root label and connector color.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait