This version is still in development and is not considered stable yet. For the latest stable version, please use Spring Shell 4.0.4!

Theming

Theming uses JLine’s AttributedString to apply styles. Unfortunately styling in JLine is mostly undocumented but we try to go through some of its features here.

In JLine a style spec is a string having a special format. Spec can be given multiple times if separated by a comma. A spec will either define a color for foreground, background or its mode. Special format <spec>:=<spec> allows to define a default within latter spec if former for some reason is invalid.

If spec contains a colon its former part indicates either foreground or background and possible values are foreground, fg, f, background, bg, b, foreground-rgb, fg-rgb, f-rgb, background-rgb, bg-rgb or b-rgb. Without RGB a color value is name from an allowable colors black, red, green, yellow, blue, magenta, cyan or white. Colors have their short formats k, r, g, y, b, m, c and w respectively. If color is prefixed with either ! or bright-, bright mode is automatically applied. Prefixing with ~ will resolve from JLine internal color-name table.

If rgb format is expected and prefixed with either x or # a normal hex format is used.

fg:red
fg:r
fg:~red
fg-rgb:xff3333
fg-rgb:#ff3333

If spec contains special names default, bold, faint, italic, underline, blink, inverse, inverse-neg, inverseneg, conceal, crossed-out, crossedout or hidden a style is changed accordingly with an existing color.

bold
bold,fg:red

A number or a list of numbers separated by semicolons is interpreted as ANSI SGR parameters.

31
31;1
JLine special mapping format which would resolve spec starting with dot can’t be used as we don’t yet map those into Spring Shell styling names.