Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting foreground directory colors via style is broken? #620

Closed
reissbaker opened this issue May 15, 2023 · 8 comments · Fixed by #622
Closed

Setting foreground directory colors via style is broken? #620

reissbaker opened this issue May 15, 2023 · 8 comments · Fixed by #622

Comments

@reissbaker
Copy link

Hello! I recently upgraded to v0.21.1 and noticed that the foreground directory colors looked a little off on my machine. Figuring that these were just the default color settings, I tried overwriting the foreground colors in two ways:

xplr.config.node_types.directory.style = {
  fg = "White"
}

And, since that didn't work, I also tried just setting the attribute alone:

xplr.config.node_types.directory.style.fg = "White"

But still no dice. FWIW, setting the background color this way works; for example:

xplr.config.node_types.directory.style.bg = "White"

Works! So I'm guessing this is just a bug in merging the default directory color with the init.lua directory color?

@sayanarijit
Copy link
Owner

Can you try unset LS_COLORS? Or set LS_COLORS accordingly using something like https://github.com/sharkdp/vivid...

@reissbaker
Copy link
Author

Unfortunately, running LS_COLORS="" LSCOLORS="" xplr still seems to ignore the xplr.config.node_types.directory.style.fg = "White" setting.

@reissbaker
Copy link
Author

reissbaker commented May 15, 2023

(I'm running this in zsh on Ubuntu, FWIW, but I figured I'd try both LS_COLORS and the macOS-/FreeBSD-style LSCOLORS just in case you were parsing both.)

@reissbaker
Copy link
Author

That being said — I think the bug actually mostly occurs if you:

  1. Have no LS_COLORS set, and
  2. Try to set the foreground color manually

When I manually set LS_COLORS, xplr respects them; but when there are none, it a) doesn't, and b) doesn't let me actually set the directory foreground colors.

I feel like my expectation would be the following priority:

  1. Highest priority is colors set in init.lua
  2. Second highest is colors from LS_COLORS

I could also understand (although would find vaguely surprising):

  1. Highest priority is LS_COLORS
  2. If there are no LS_COLORS set, then whatever is in init.lua

But instead it seems like:

  1. Colors in LS_COLORS
  2. Some default colors?
  3. (It is impossible to set the foreground colors of directories from init.lua)

Which seems like a bug?

sayanarijit added a commit that referenced this issue May 15, 2023
Do not default to a LS_COLOR theme.

Fixes #620
@sayanarijit
Copy link
Owner

Agree with Highest priority is colors set in init.lua.

Initially, I thought of giving LS_COLORS more priority because it's easier to change than init.lua, thus easy to switch between different themes.

But now I learned that applications by convention default to a set LS_COLORS theme even if it's not set or is set to an empty string, and it is expected to be overridden by the application specific theming.

So yes, making LS_COLORS low priority makes more sense.

sayanarijit added a commit that referenced this issue May 15, 2023
@sayanarijit
Copy link
Owner

Pls test #622 and let me know how it works...

@sayanarijit
Copy link
Owner

Update: With LS_COLOR having less priority, I think now it makes sense to unset the defaults.

@reissbaker
Copy link
Author

Such a fast fix! Tested and it works on my machine 😁

sayanarijit added a commit that referenced this issue May 16, 2023
* Lower LS_COLORS priority

Fixes: #620

* Remove default style

* Fix doc markdown
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants