diff --git a/NEWS b/NEWS index 4cd66af7..df48b970 100644 --- a/NEWS +++ b/NEWS @@ -1,8 +1,8 @@ lnav v0.8.6: Features: * Added support for themes and included a few as well: default, - night-owl, solarized-light, and solarized-dark. The theme can - be changed using the ':config' command, like so: + monocai, night-owl, solarized-light, and solarized-dark. The theme + can be changed using the ':config' command, like so: :config /ui/theme night-owl Consult the online documentation for defining a new theme. diff --git a/src/Makefile.am b/src/Makefile.am index 6f92ff95..50f73948 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -29,6 +29,7 @@ default-log-formats-json.c: $(srcdir)/default-log-formats.json bin2c CONFIG_FILES = \ $(srcdir)/root-config.json \ $(srcdir)/themes/default.json \ + $(srcdir)/themes/monocai.json \ $(srcdir)/themes/night-owl.json \ $(srcdir)/themes/solarized-dark.json \ $(srcdir)/themes/solarized-light.json \ @@ -145,6 +146,7 @@ dist_noinst_DATA = \ root-config.json \ search-for.lnav \ themes/default.json \ + themes/monocai.json \ themes/night-owl.json \ themes/solarized-dark.json \ themes/solarized-light.json diff --git a/src/log_format_loader.cc b/src/log_format_loader.cc index b8b06c84..de4e6e75 100644 --- a/src/log_format_loader.cc +++ b/src/log_format_loader.cc @@ -982,14 +982,8 @@ void load_format_extra(sqlite3 *db, const std::vector &extra_paths, std::vector &errors) { - exec_sql_in_path(db, "/etc/lnav", errors); - exec_sql_in_path(db, SYSCONFDIR "/lnav", errors); - exec_sql_in_path(db, dotlnav_path(""), errors); - - for (vector::const_iterator path_iter = extra_paths.begin(); - path_iter != extra_paths.end(); - ++path_iter) { - exec_sql_in_path(db, *path_iter, errors); + for (const auto & extra_path : extra_paths) { + exec_sql_in_path(db, extra_path, errors); } } @@ -1064,14 +1058,8 @@ static void find_format_in_path(const string &path, void find_format_scripts(const vector &extra_paths, map > &scripts) { - find_format_in_path("/etc/lnav", scripts); - find_format_in_path(SYSCONFDIR "/lnav", scripts); - find_format_in_path(dotlnav_path(""), scripts); - - for (vector::const_iterator path_iter = extra_paths.begin(); - path_iter != extra_paths.end(); - ++path_iter) { - find_format_in_path(*path_iter, scripts); + for (const auto &extra_path : extra_paths) { + find_format_in_path(extra_path, scripts); } } @@ -1080,9 +1068,7 @@ void load_format_vtabs(log_vtab_manager *vtab_manager, { map &root_formats = LOG_FORMATS; - for (map::iterator iter = root_formats.begin(); - iter != root_formats.end(); - ++iter) { - iter->second->register_vtabs(vtab_manager, errors); + for (auto & root_format : root_formats) { + root_format.second->register_vtabs(vtab_manager, errors); } } diff --git a/src/themes/monocai.json b/src/themes/monocai.json new file mode 100644 index 00000000..b9cb1a7e --- /dev/null +++ b/src/themes/monocai.json @@ -0,0 +1,144 @@ +{ + "ui": { + "theme-defs": { + "monocai": { + "vars": { + "black": "#2d2a2e", + "red": "#f92772", + "green": "#a7e22e", + "yellow": "#fe9720", + "blue": "#5394ec", + "magenta": "#ae81ff", + "cyan": "#66d9ee", + "white": "#808080" + }, + "styles": { + "identifier": { + "background-color": "#2d2a2e" + }, + "text": { + "color": "#f6f6f6", + "background-color": "#2d2a2e" + }, + "alt-text": { + "color": "#f6f6f6", + "background-color": "#2d2a2e", + "bold": true + }, + "ok": { + "color": "$green", + "bold": true + }, + "error": { + "color": "$red", + "bold": true + }, + "warning": { + "color": "$yellow", + "bold": true + }, + "hidden": { + "color": "$yellow", + "bold": true + }, + "adjusted-time": { + "color": "$magenta" + }, + "skewed-time": { + "color": "$yellow" + }, + "offset-time": { + "color": "$cyan" + }, + "popup": { + "color": "$base00", + "background-color": "$base3" + } + }, + "syntax-styles": { + "keyword": { + "color": "#ff6188", + "bold": true + }, + "string": { + "color": "#ffd866", + "bold": true + }, + "comment": { + "color": "#727072" + }, + "variable": { + "color": "#a9dc76" + }, + "symbol": { + "color": "#78dce8" + }, + "re-special": { + "color": "$cyan" + }, + "re-repeat": { + "color": "$yellow" + }, + "diff-delete": { + "color": "#8f5247" + }, + "diff-add": { + "color": "#294436" + }, + "diff-section": { + "color": "#656e76" + }, + "file": { + "color": "$blue" + } + }, + "status-styles": { + "title": { + "color": "#f6f6f6", + "background-color": "#5394ec", + "bold": true + }, + "subtitle": { + "color": "#555", + "background-color": "#66d9ee", + "bold": true + }, + "text": { + "color": "#f6f6f6", + "background-color": "#353535" + }, + "warn": { + "color": "$yellow", + "background-color": "#353535" + }, + "alert": { + "color": "$red", + "background-color": "#353535" + }, + "active": { + "color": "$green", + "background-color": "#353535" + }, + "inactive": { + "color": "#555", + "background-color": "#2f2f2f" + } + }, + "log-level-styles": { + "warning": { + "color": "$yellow" + }, + "error": { + "color": "$red" + }, + "critical": { + "color": "$red" + }, + "fatal": { + "color": "$red" + } + } + } + } + } +} \ No newline at end of file diff --git a/test/Makefile.am b/test/Makefile.am index ca2b36fd..0dab9cf9 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -254,6 +254,8 @@ dist_noinst_DATA = \ bad-config/formats/invalid-sql/init.sql \ bad-config/formats/no-samples/format.json \ bad-config2/formats/invalid-config/config.json \ + bad-config2/formats/invalid-config/config.malformed.json \ + bad-config2/formats/invalid-config/config.truncated.json \ bad-config-json/formats/invalid-json/format.json \ bad-config-json/formats/invalid-key/format.json \ datafile_simple.0 \