Skip to content

Latest commit

 

History

History
59 lines (44 loc) · 1.92 KB

File metadata and controls

59 lines (44 loc) · 1.92 KB

Theming

Current terminal implementations are rich in features and can usually show something else that just plain text. For example a text can be styled to be bold or have different colors. It’s also common for terminals to be able to show various characters from an unicode table like emoji’s which are usually used to make shell output more pretty.

Spring Shell supports these via it’s theming framework which contains two parts, firstly styling can be used to change text type and secondly figures how some characters are shown. These two are then combined together as a theme.

More about theming internals, see Theming.

Note
Default theme is named default but can be change using property spring.shell.theme.name. Other built-in theme named dump uses no styling for colors and tries to not use any special figures.

Modify existing style by overriding settings.

link:../../../../src/test/java/org/springframework/shell/docs/ThemingSnippets.java[role=include]

Modify existing figures by overriding settings.

link:../../../../src/test/java/org/springframework/shell/docs/ThemingSnippets.java[role=include]

To create a new theme, create a ThemeSettings and provide your own style and figure implementations.

link:../../../../src/test/java/org/springframework/shell/docs/ThemingSnippets.java[role=include]

Register a new bean Theme where you can return your custom ThemeSettings and a theme name.

link:../../../../src/test/java/org/springframework/shell/docs/ThemingSnippets.java[role=include]

You can use ThemeResolver to resolve styles if you want to create JLine-styled strings programmatically and figures if you want to theme characters for being more pretty.

link:../../../../src/test/java/org/springframework/shell/docs/ThemingSnippets.java[role=include]