Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REPL demo: add nanorctheme.template #761

Merged
merged 1 commit into from
Dec 20, 2021
Merged

Conversation

mattirn
Copy link
Collaborator

@mattirn mattirn commented Dec 20, 2021

Nanorc theme system helps to keep colors uniform across different languages and also to keep the definitions clear and maintainable. The system allows highlight rules in nanorc files to be specified in terms of token type names or mixins, instead of hard-coded colors.

In REPL demo the theme system has been extended to define highlight rules also for COLORS variables (HELP_COLORS, LS_COLORS, etc) and lineReader's COMPLETION_STYLEs. Extended theme system requires that CLI app supports Map type console variables. Below is shown all relevant console variables needed by the theme system. Console option NANORC_THEME map is created when executing the builtins command: highlighter --refresh or highlighter --switch=<new-theme>. The highlighter command will refresh also lineReader's COMPLETION_STYLEs and all syntaxHighlighters used by REPL demo.

nanorctheme-template

You can define your nanorc theme using 16 colors and switch between different color themes by changing your terminal 16 colors palette. Available themes and installation instructions see for example Gogh, iTerm2-Color-Schemes and microsoft/ColorTool.

If your terminal color palette is not easily replaceable you can also use hard-coded color definitions in your nanorc theme file. Nanorc theme with hard-coded color definitions can be created using nanorctheme.template, apply-colors.sh and Gogh install like:

Linux:

\> cd git/jline3
\> ./build rebuild
\> cd demo/target/nanorc
\> bash -c  "$(wget -qO- https://git.io/vQgMr)" 

@mattirn mattirn merged commit aa11f6e into jline:master Dec 20, 2021
@mattirn mattirn deleted the nanorc-template branch May 7, 2024 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant