Closed sam9032 closed 1 year ago
The default syntax theme inside the fm.yml
file is dracula
which is better suited for dark themed terminals. You can change the syntax theme inside the config to something like pygments
which should work on light and dark themed terminals. I might consider updating the default to something that is better suited for both
Thank you, pygments
works better for me.
You wrote in your README.md "Colors adapt to terminal background" and in this issue #34 about support for different terminal backgrounds/themes. Is there a way, to define different themes for light and dark terminal background?
Welcome! Let me look into this a little more and try to get something out there so light and dark syntax themes can be set in the config file
It's true that the syntax theme does not work with light mode right now, but judging from @sam9032's screenshot there seems to be another issue with fm's UI on the left. For example, the text color of the file size on the left is black for the dark terminal screenshot, although it should be white. This has already been implemented in 550ff774d868cd4d7824ae8f72aed2e69a0fead5 and it works on my end (I get white text color on a dark terminal).
It looks like the terminal background detection is using $COLORFGBG
, perhaps this environment variable is not set on your configuration.
If you set $COLORFGBG
, it should work, however the issue with the syntax theme of the displayed file is a problem that I am experiencing as well.
It's true that the syntax theme does not work with light mode right now, but judging from @sam9032's screenshot there seems to be another issue with fm's UI on the left. For example, the text color of the file size on the left is black for the dark terminal screenshot, although it should be white. This has already been implemented in 550ff77 and it works on my end (I get white text color on a dark terminal).
It looks like the terminal background detection is using
$COLORFGBG
, perhaps this environment variable is not set on your configuration.If you set
$COLORFGBG
, it should work, however the issue with the syntax theme of the displayed file is a problem that I am experiencing as well.
Seems like gnome doesn't set the $COLORFGBG
variable? Its empty.
https://bugzilla.gnome.org/show_bug.cgi?id=733423
https://github.com/neovim/neovim/issues/2764
@sam9032 I opened up #81 let me know if something like that would be useful. It will allow you to set a light and dark syntax theme and then based on your terminal color it will use the appropriate one
@sam9032 I opened up #81 let me know if something like that would be useful. It will allow you to set a light and dark syntax theme and then based on your terminal color it will use the appropriate one
This would be amazing and exactly what I am looking for! Thank you :rocket:
I'm just afraid that libgloss or better termenv in libgloss builds on the $COLORFGBG
and that's why no automatic detection in the Gnome terminal is possible at the moment.
Just tried this example in the termenv repo: https://github.com/muesli/termenv/blob/master/examples/hello-world/main.go
And oddly enough it detects my terminal background correctly. :sweat_smile:
On a closer look, it looks like termenv only uses $COLORFGBG as fallback. First it tries to use OSC 11 to request the background color, which seems to be then working: https://github.com/muesli/termenv/blob/89347d64da90146184f36fa636a743da8595fd42/termenv_unix.go#L67
Then if it is detected correctly, the only weird thing is that fm shows black on black text color in your second screenshot.
Am Fri, Jan 21, 2022 at 05:53:42AM -0800 schrieb sam:
Just tried this example in the termenv repo: https://github.com/muesli/termenv/blob/master/examples/hello-world/main.go
And oddly enough it detects my terminal background correctly. :sweat_smile:
-- Reply to this email directly or view it on GitHub: https://github.com/knipferrc/fm/issues/78#issuecomment-1018523920 You are receiving this because you are subscribed to this thread.
Message ID: @.***>
On a closer look, it looks like termenv only uses $COLORFGBG as fallback. First it tries to use OSC 11 to request the background color, which seems to be then working: https://github.com/muesli/termenv/blob/89347d64da90146184f36fa636a743da8595fd42/termenv_unix.go#L67 Then if it is detected correctly, the only weird thing is that fm shows black on black text color in your second screenshot. Am Fri, Jan 21, 2022 at 05:53:42AM -0800 schrieb sam: … Just tried this example in the termenv repo: https://github.com/muesli/termenv/blob/master/examples/hello-world/main.go And oddly enough it detects my terminal background correctly. sweat_smile -- Reply to this email directly or view it on GitHub: #78 (comment) You are receiving this because you are subscribed to this thread. Message ID: @.***>
It seems like fm doesn't change the theme while running. If I start with a dark terminal the colors on the left site seem to be fine. But if I switch to a light terminal theme while fm is open, it is even more beautiful :sweat_smile:
It seems like fm doesn't change the theme while running. If I start with a dark terminal the colors on the left site seem to be fine. But if I switch to a light terminal theme while fm is open, it is even more beautiful sweat_smile
That is indeed very beautiful. Some terminals abuse the SIGWINCH
signal to notify running CLI programs that the colorscheme changed (see e.g. https://github.com/neovim/neovim/pull/16030), but fm
would first need to listen to that signal to support this kind of advanced runtime theme switching.
Yeah in its current state a change in theme of the terminal would require restarting fm
. Also, the PR for dark and light syntax themes has been merged now, will cut a release a little later today
If I use the default terminal on linux Gnome with a light theme, the text on the right side isn't readable:
Seems like the colors in the preview are made for dark mode, but the filebrowser on the left site got black on grey text if I switch the terminal to dark mode: