Custom theme location does not seem to work?
ylluminate opened this issue · 4 comments
lnav version: lnav 0.12.2
(macOS 14, via Homebrew)
Describe the bug
I'm unable to load a custom theme in lnav
despite following the instructions provided in the documentation. The custom theme file is placed in the specified directory, but lnav
does not recognize it.
Fwiw, I've tried the indicated directory and others that I thought could be an option:
~/.lnav/configs/installed/
~/.lnav/configs/themes/
~/.lnav/themes/
~/.config/lnav/configs/installed/
~/.config/lnav/configs/themes/
~/.config/lnav/themes/
The theme file that was put into each of these folders is tokyonight-storm-theme.json
.
When I modify the config.json file directly with the theme name, I get:
$ lnav
✘ error: invalid value for property “/ui/theme”
reason: unknown theme -- “tokyonight-storm”
| = help: The available themes are: default, dracula, eldar, grayscale, monocai, night-owl, solarized-dark, solarized-light
--> /Users/username/.config/lnav/config.json:3
= help: Property Synopsis
/ui/theme theme_name
Description
The name of the theme to use.
Likewise :config /ui/theme <spacebar>
does not evoke the theme name and just entering the name verbatim there (sans -theme
) also fails to load/detect.
Could you please clarify how to load custom themes with some more explicit details?
Fwiw, I've tried the indicated directory and others that I thought could be an option:
~/.lnav/configs/installed/
~/.lnav/configs/themes/
~/.lnav/themes/
~/.config/lnav/configs/installed/
~/.config/lnav/configs/themes/
~/.config/lnav/themes/
Running lnav -h
should show the lnav directory that would be used. This is what I see:
Paths
• Format files are read from:
📂 /etc/lnav
📂 /usr/local/etc/lnav
• Configuration, session, and format files are stored in:
📂 /Users/tstack/.config/lnav
Under that directory, configs/installed
should work.
The theme file that was put into each of these folders is
tokyonight-storm-theme.json
.
Would you be able to attach this file?
A configuration file must have a $schema
property in the top level object, like so:
"$schema": "https://lnav.org/schemas/config-v1.schema.json"
To get a dump of the full lnav configuration, you can run lnav -m config get
. To get a listing of where the value of each property came from, you can run lnav -m config blame
.
Running lnav with -d /tmp/lnav-debug.log
will write the lnav debug log to that file. Near the start there are some log messages related to loading the configuration. In the snippet below, you can see a theme configuration being loaded:
2024-05-23T20:56:54.287-07:00 I t0 lnav.cc:2559 lnav started
2024-05-23T20:56:54.290-07:00 I t0 lnav_config.cc:1879 loading builtin configuration into default
2024-05-23T20:56:54.295-07:00 I t0 lnav_config.cc:1881 loading builtin configuration into base
2024-05-23T20:56:54.300-07:00 I t0 lnav_config.cc:1884 loading installed configuration files
2024-05-23T20:56:54.300-07:00 I t0 lnav_config.cc:1769 loading configuration from /Users/tstack/.config/lnav/configs/installed/config.simple_theme.json
2024-05-23T20:56:54.300-07:00 I t0 lnav_config.cc:1769 loading configuration from /Users/tstack/.config/lnav/configs/installed/config.simple_theme.json
2024-05-23T20:56:54.301-07:00 I t0 lnav_config.cc:1914 loading user configuration
2024-05-23T20:56:54.301-07:00 I t0 lnav_config.cc:1769 loading configuration from /Users/tstack/.config/lnav/config.json
Let me know what happens, there might be a better error/help message I can add somewhere.
Hmm, interesting. I had been running lnav
for years with config info under ~/.lnav/
instead of ~/.confifig/lnav/
...
Here's the theme (along with the command to cat it so you can see the source location): cat_of_tokyonight-storm-theme.json
Shell incantations:
# tried to start after ensured it was in a properly supported path of ~/.config/lnav/configs/installed/tokyonight-storm-theme.json
$ lnav
✘ error: invalid value for property “/ui/theme”
reason: unknown theme -- “tokyonight-storm”
| = help: The available themes are: default, dracula, eldar, grayscale, monocai, night-owl, solarized-dark, solarized-light
--> /Users/username/.config/lnav/config.json:3
= help: Property Synopsis
/ui/theme theme_name
Description
The name of the theme to use.
# attempted suggested command, again with the theme name inserted into config.json of `"theme": "tokyonight-storm"`:
$ lnav -m config get
✘ error: invalid value for property “/ui/theme”
reason: unknown theme -- “tokyonight-storm”
| = help: The available themes are: default, dracula, eldar, grayscale, monocai, night-owl, solarized-dark, solarized-light
--> /Users/username/.config/lnav/config.json:3
= help: Property Synopsis
/ui/theme theme_name
Description
The name of the theme to use.
# attempted to modify theme name to `"theme": "tokyonight-storm-theme"`:
$ nano ~/.config/lnav/config.json
# again attempted suggested command:
$ lnav -m config get
✘ error: invalid value for property “/ui/theme”
reason: unknown theme -- “tokyonight-storm-theme”
| = help: The available themes are: default, dracula, eldar, grayscale, monocai, night-owl, solarized-dark, solarized-light
--> /Users/username/.config/lnav/config.json:3
= help: Property Synopsis
/ui/theme theme_name
Description
The name of the theme to use.
# other suggested command just for thoroughness, knowing it wouldn't yield much:
$ lnav -m config blame
✘ error: invalid value for property “/ui/theme”
reason: unknown theme -- “tokyonight-storm-theme”
| = help: The available themes are: default, dracula, eldar, grayscale, monocai, night-owl, solarized-dark, solarized-light
--> /Users/username/.config/lnav/config.json:3
= help: Property Synopsis
/ui/theme theme_name
Description
The name of the theme to use.
# debug generation:
$ lnav -d /tmp/lnav-debug.log
✘ error: invalid value for property “/ui/theme”
reason: unknown theme -- “tokyonight-storm-theme”
| = help: The available themes are: default, dracula, eldar, grayscale, monocai, night-owl, solarized-dark, solarized-light
--> /Users/username/.config/lnav/config.json:3
= help: Property Synopsis
/ui/theme theme_name
Description
The name of the theme to use.
Debug output: lnav-debug.log
The debug log contains attempted start with both the name defined as tokyonight-storm-theme
and as tokyonight-storm
in the config.json
, so seems to indicate the theme is maybe being loaded, but still no success...
You need to change “default” under “theme-defs” to the theme name. The name does not come from the file name. Right now, that file is overriding the default theme properties.
So you're saying config.json
should have:
{
"ui": {
"theme": "tokyonight-storm",
"theme-defs": {
"tokyonight-storm": {
"highlights": {
...
This does seem to evoke a change - even though now I simply lack formatting. I have to assume that the actual theme is not configured properly and now it will be a matter of iterating through the json theme file to implement a theme that I would expect to see.
Thanks.