Skip to content

Commit

Permalink
REPL demo: add light.nanorctheme and rename default theme to dark
Browse files Browse the repository at this point in the history
  • Loading branch information
mattirn committed Dec 20, 2021
1 parent f72694f commit 4312712
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 15 deletions.
2 changes: 1 addition & 1 deletion demo/src/main/java/org/jline/demo/Repl.java
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ public static void main(String[] args) {
File jnanorcFile = Paths.get(root, DEFAULT_NANORC_FILE).toFile();
if (!jnanorcFile.exists()) {
try (FileWriter fw = new FileWriter(jnanorcFile)) {
fw.write("theme " + root + "nanorc/*.nanorctheme\n");
fw.write("theme " + root + "nanorc/dark.nanorctheme\n");
fw.write("include " + root + "nanorc/*.nanorc\n");
}
}
Expand Down
2 changes: 1 addition & 1 deletion demo/src/main/scripts/command.nanorc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
syntax "COMMAND"

FUNCTION: "[a-zA-Z]+[a-zA-Z0-9]*"
COMMAND: "[a-zA-Z]+[a-zA-Z0-9]*"
VARIABLE: ".*="
PLAIN: "(\"|'|\.|=|:|\[|,|\])"
COMMENT: "(^|\\s+)#.*$"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file describes a default scheme for nanorc syntax highlighting.
# This file describes a default scheme for nanorc syntax highlighting for terminals with dark background
#
# Lines that start with a # character are comments.
# Comments are ignored. Empty lines are ignored too. Leading/trailing white
Expand Down Expand Up @@ -34,33 +34,31 @@ BOOLEAN brightwhite
NULL cyan
NUMBER blue
VARIABLE brightyellow
PACKAGE green,,faint
PACKAGE green,faint
CLASS green
CONSTANT yellow
OPERATOR yellow
COMMAND brightgreen
OPTION yellow
KEYWORD brightwhite
MACRO brightmagenta
DELIMITER brightred
JUMP brightcyan
SECTION brightgreen
TAG brightwhite
ATTRIBUTE green
CHARREF brightred
PATH brightblue
URL brightblue
EMAIL brightblue
EXECUTABLE green
LINK cyan
TITLE brightblue
ESCAPE black,cyan
REGEXP blue,cyan
DEBUG brightmagenta
ERROR red
TODO brightwhite,cyan
WARNING ,red
WHITESPACE ,green
HEADER bold,!blue,~grey7,underline
ROW_NUMBER bold,!blue,~grey7
ROW_STYLE ,~grey15
DEBUG brightmagenta
LIST_BACKGROUND ,~grey42
LIST_GROUP ~greenyellow
LIST_GROUP yellow
#
# mixin
#
Expand Down
8 changes: 6 additions & 2 deletions demo/src/main/scripts/init.jline
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ CONSOLE_OPTIONS['docs'].put('java.*',['https://docs.oracle.com/javase/8/docs/api
'http://docs.groovy-lang.org/latest/html/groovy-jdk/'])
CONSOLE_OPTIONS['docs'].put('.*/java.*','https://docs.oracle.com/javase/8/docs/api/')
CONSOLE_OPTIONS['docs'].put('org/jline/.*','https://www.javadoc.io/doc/org.jline/jline/latest/')
CONSOLE_OPTIONS.PRNT_COLORS = 'th=HEADER:rn=ROW_NUMBER:rs=ROW_STYLE:mk=ATTRIBUTE:em=WARNING:vs=DEBUG'
CONSOLE_OPTIONS.PRNT_COLORS = 'th=HEADER:rn=ROW_NUMBER:rs=ROW_STYLE:mk=ATTRIBUTE:em=ERROR:vs=DEBUG'
CONSOLE_OPTIONS.LS_COLORS = 'di=PATH:ex=EXECUTABLE:ln=LINK:fi='
CONSOLE_OPTIONS.HELP_COLORS = "ti=TITLE:co=1:ar=3:op=OPTION"
CONSOLE_OPTIONS.READER_COLORS = [:]
CONSOLE_OPTIONS['READER_COLORS'].put('COMPLETION_STYLE_LIST_BACKGROUND', 'LIST_BACKGROUND')
CONSOLE_OPTIONS['READER_COLORS'].put('COMPLETION_STYLE_LIST_GROUP', 'LIST_GROUP')
Expand Down Expand Up @@ -91,7 +93,9 @@ GROOVY_OPTIONS.metaMethodsCompletion = false
GROOVY_OPTIONS.allClassesCompletion = false
GROOVY_OPTIONS.allConstructorsCompletion = false
GROOVY_OPTIONS.syntheticMethodsCompletion = false

GROOVY_OPTIONS.GROOVY_COLORS = 'ti=TITLE:me=ERROR'
GROOVY_OPTIONS.nanorcSyntax = 'Java'
GROOVY_OPTIONS.nanorcValue = 'GRON'
#
# custom Groovy pipes
#
Expand Down
51 changes: 51 additions & 0 deletions demo/src/main/scripts/light.nanorctheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#
# This file describes a default scheme for nanorc syntax highlighting for terminals with light background.
#

PLAIN black
FUNCTION green
STRING cyan
COMMENT brightcyan
DOC_COMMENT cyan
TYPE brightblue
BOOLEAN brightblack
NULL cyan
NUMBER blue
VARIABLE brightyellow
PACKAGE green,faint
CLASS green
CONSTANT yellow
OPERATOR yellow
COMMAND green
OPTION yellow
KEYWORD brightblack
JUMP cyan
SECTION green
ATTRIBUTE green
PATH brightblue
EXECUTABLE green
LINK cyan
TITLE brightblue
ESCAPE black,cyan
DEBUG brightmagenta
ERROR red
TODO brightwhite,cyan
WARNING ,lightred
WHITESPACE ,lightgreen
HEADER bold,!blue,~grey70,underline
ROW_NUMBER bold,!blue,~grey70
ROW_STYLE ,~grey82
LIST_BACKGROUND ,~grey70
LIST_GROUP yellow
#
# mixin
#
+FUNCTION FUNCTION: "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[(]" \n PLAIN: "[(]"
+LINT WHITESPACE: "[[:space:]]+$" \n WARNING: "\t*"
+LONG_LINE_WARNING WARNING: "^.{81,}$"
#
# parser
#
$LINE_COMMENT COMMENT \n TODO: "FIXME|TODO|XXX"
$BLOCK_COMMENT COMMENT \n DOC_COMMENT: startWith=/** \n TODO: "FIXME|TODO|XXX"
$BALANCED_DELIMITERS STRING \n VARIABLE: continueAs=\s*:

0 comments on commit 4312712

Please sign in to comment.