Package org.jline.style
package org.jline.style
JLine Style package provides a comprehensive styling system for terminal output.
This package contains classes and interfaces for defining, managing, and applying styles to text displayed in the terminal. It supports:
- Style specifications using a simple syntax (e.g., "bold,fg:red")
- Named styles that can be referenced and reused
- Style expressions with the format
@{style text} - Style bundles using Java interfaces and proxies
- Style sources for storing and retrieving style definitions
The styling system integrates with JLine's AttributedString and
AttributedStyle classes to provide rich text formatting capabilities.
Key components of this package include:
StyleBundle- Interface for proxy-based style bundlesStyleExpression- Evaluates style expressionsStyleFactory- Creates styled stringsStyleResolver- Resolves named stylesStyleSource- Interface for style storageStyler- Facade for style operations
Example usage:
// Using StyleFactory
StyleFactory factory = Styler.factory("mygroup");
AttributedString text = factory.style("bold,fg:red", "Important message");
// Using StyleExpression
StyleExpression expr = new StyleExpression(Styler.resolver("mygroup"));
AttributedString text = expr.evaluate("Normal text with @{bold,fg:red important} parts");
// Using StyleBundle
@StyleBundle.StyleGroup("mygroup")
interface MyStyles extends StyleBundle {
@DefaultStyle("bold,fg:red")
AttributedString important(String text);
}
MyStyles styles = Styler.bundle(MyStyles.class);
AttributedString text = styles.important("Important message");
- Since:
- 3.4
-
ClassDescriptionInterpolation.In-memory implementation of
StyleSource.A no-operation implementation ofStyleSourcethat always returnsnull.Marker interface for proxy-based style bundles.Annotation that provides a default style specification for a method in a StyleBundle interface.Annotation that specifies the style group name for a StyleBundle interface.Annotation that allows overriding the style name for a method in a StyleBundle interface.Deprecated.APrintWriterextension that understands and evaluatesStyleExpressionsyntax.Provides evaluation of style expressions in the format@{style value}.Factory for creating styled strings using a specific style group.Style facade that provides static utility methods for working with styles.Resolves named (or source-referenced)AttributedStylefor a specific style group.Interface for sources of style configuration.
Colors.rgbColor(String)instead