Class StyleResolver

java.lang.Object
org.jline.utils.StyleResolver
org.jline.style.StyleResolver

public class StyleResolver extends StyleResolver
Resolves named (or source-referenced) AttributedStyle for a specific style group.

This class extends StyleResolver to add support for style groups and style sources. It allows resolving style specifications into AttributedStyle objects, with the ability to look up named styles from a StyleSource.

Style specifications can be in the following formats:

  • Direct style specifications: "bold,fg:red,bg:blue,underline"
  • Named style references: ".error" (looks up "error" in the current style group)
  • Named style references with defaults: ".error:-bold,fg:red" (uses default if named style is not found)

Example usage:

 StyleSource source = new MemoryStyleSource();
 source.set("mygroup", "error", "bold,fg:red");

 StyleResolver resolver = new StyleResolver(source, "mygroup");
 AttributedStyle style1 = resolver.resolve("bold,fg:blue");       // Direct style
 AttributedStyle style2 = resolver.resolve(".error");              // Named style
 AttributedStyle style3 = resolver.resolve(".missing:-underline"); // Default style
 
Since:
3.4
See Also: