Canop / broot

A new way to see and navigate directory trees : https://dystroy.org/broot
MIT License
10.81k stars 237 forks source link

Wrong light colorscheme in zellij #862

Open apraga opened 7 months ago

apraga commented 7 months ago

Hi,

Using zellij light theme (tested with solarized-light), broot's own light theme (also solarized) looks bad inside zellij : broot-zellij

but fine outside zellij broot

Broot correctly detects it's a light theme though. My conf.hjson :

imports: [
    verbs.hjson

    {
        luma: [
            dark
            unknown
        ]
        file: skins/dark-gruvbox.hjson
    }
    {
        luma: light
        file: skins/solarized-light.hjson
    }
]

Terminal: alacritty, with solarized-light here. Any idea would be great, thanks !

Canop commented 7 months ago

Broot correctly detects it's a light theme though

Are you sure ? Can you have a look at the debug log ?

apraga commented 7 months ago

Interesting. It is detecting the light theme in both case but apply the dark theme ? In zellij

19:15:25.548 [DEBUG] broot::display::luma: terminal_light::luma() took 421.902µs
19:15:25.548 [INFO] broot::display::luma: terminal's luma: Ok(0.15625)
19:15:25.548 [DEBUG] broot::conf::conf: reading conf file: "/home/alex/.config/broot/skins/dark-gruvbox.hjson"
19:15:25.550 [DEBUG] broot::conf::conf: skipping not applying conf file : "skins/solarized-light.hjson"

Outside zellij

19:14:47.681 [DEBUG] broot::display::luma: terminal_light::luma() took 209.449µs
19:14:47.681 [INFO] broot::display::luma: terminal's luma: Ok(0.96371955)
19:14:47.681 [DEBUG] broot::conf::conf: skipping not applying conf file : "skins/dark-gruvbox.hjson"
19:14:47.681 [DEBUG] broot::conf::conf: reading conf file: "/home/alex/.config/broot/skins/solarized-light.hjson"

I've edited the issue with the full configuration for dark and light theme.

Canop commented 7 months ago

In your first log (zellij), the terminal is seen as dark (luma = 0.15625), and the dark theme is applied

Canop commented 7 months ago

It's a little weird. There are many reasons to not be able to detect the background color, but there should not be any wrong detection.

If you're always on a light background, an obvious workaround is to just not detect and always apply the light theme.

apraga commented 7 months ago

Here's a screenshot of the whole zellij windows :

zellij

Maybe the black borders are confusing the luma computation ? I'm switching between dark and light depending on the time of the day :)

Edit could you show how to force a given theme whatever the luma ? Thanks.

Canop commented 7 months ago

To force the theme, do

imports: [
    verbs.hjson
    skins/dark-gruvbox.hjson
]
apraga commented 7 months ago

Further testing: same results in other shells (fish, sh, initially tested with nushell). I've tested (at least I hope) your strategy in terminal-light using terminal escape code. In zellij

~> printf "\x1b]11;?\x07"
~> ]11;rgb:fbfb/f1f1/c7c7

Outside zellij

 ~/.c/broot> printf "\x1b]11;?\x07"
~/.c/broot> ]11;rgb:2828/2828/2828^C

By the way, feel free to move the issue in terminal-light !