AstroNvim / astrotheme

The default colorscheme used by AstroNvim
https://AstroNvim.com
GNU General Public License v3.0
96 stars 19 forks source link

Floats blend with main window (no borders or different bg color) #124

Closed lfilho closed 4 months ago

lfilho commented 4 months ago

Checklist

Neovim version (nvim -v)

0.9.5

Operating system/version

macOS 14

Terminal/GUI

iterm2

Describe the bug

See screenshots below featuring Mason and Telescope: the floating windows blend with the theme's dark background, so it's not too nice to look at, hard to say where one begins and the other ends.

It would be nice to either change backgrounds colors (make the float a different bg color or maybe dim the underlying windows. The issue is worse with Mason because there's no border at all (see screenshots).

Steps to Reproduce

  1. Open a float (Telescope or Mason, for example)
  2. See it the background is the same and that's is hard to tell it apart from the underlying windows

Expected behavior

I'd like to clearly see it's a floating window

Screenshots

CleanShot 2024-05-07 at 17 37 35

CleanShot 2024-05-07 at 17 41 47

Additional Context

Thank you!

mehalter commented 4 months ago

have you customized the AstroTheme configuration at all? The default AstroNvim setup dims pretty heavily

2024-05-07_20:47:55_screenshot

lfilho commented 4 months ago

Hey @mehalter thanks for replying. I have not customized astro theme's or highlights. But notice how even on your screenshot we can't tell where Mason's window starts or ends. It seems it's dimming the fg but not the bg?

The autocompletion with <C-Space> is a bit better because it at least has a border:

CleanShot 2024-05-07 at 18 12 32

But the one with <C-n> doesn't: CleanShot 2024-05-07 at 18 13 29

Feels like all those floats should behave the same and have a clear indication they're a float/modal on top of something else

mehalter commented 4 months ago

these plugins all have different methods of things. the completion menus are Pmenus and not buffers. Buffers are darkened when they are not active and active buffers are lightened. That is why the mason window is lightened and the background is darkened. Mason does not have a border by default and I'm not sure if it's configurable. It's unrelated to the highlights in this case. The <C-n> menu is the default completion also not something with a border. We go out of our way to add a border to cmp because it makes it easier

mehalter commented 4 months ago

because active windows are lightened, floating menus are naturally darkened to create a strong contrast and clear semantic separation. I don't think we want to change these default highlights at all because of this

mehalter commented 4 months ago

If you play around with it and come up with some better defaults feel free to open a PR with suggestions

lfilho commented 4 months ago

Thanks @mehalter

these plugins all have different methods of things.

Yeah, I get that. So are you saying that for Astro's theme there's not appetite to provide that more consistent experience/UX across those plugins? I thought that for those in particular we would since they're an integral part of AstroNvim itself.

to create a strong contrast and clear semantic separation

That's exactly what i want! My point here is that it is not happening. i.e. the contrast is not high enough, it is barely visible! You have to squint to (maybe) be able to tell where the floats start and end

If you play around with it and come up with some better defaults feel free to open a PR with suggestions

will do. As a matter of fact i was trying it as this thread developed, and I ran into a hiccup. The v4 template suggests using "astrotheme" as key to customize highlights: https://github.com/AstroNvim/template/blob/main/lua/plugins/astroui.lua#L20 but that didn't work for me. but if I change it to "astrodark" then it works. Even when i do ":colors astrotheme" and the immediately i call ":colors", the result is "astrodark", not "astrotheme", so that might be preventing the customizations to work like the template suggests.

Will follow up here when i have something to show/propose. Thanks again

lfilho commented 4 months ago

Thoughts? Played with it for a bit. Here's how a completion and Mason looks like. Thoughts?

CleanShot 2024-05-07 at 19 46 41

CleanShot 2024-05-07 at 19 47 16

mehalter commented 4 months ago

This doesn't fit with the vibe and decreases contrast within the window. Also it doesn't seem to really change the contrast all that much between the foreground and background windows. It seems to be more warm toned and brown rather than the cool toned and blueish part of the theme

lfilho commented 4 months ago

Welp, I tried :D

I'll leave the config here if people in the future is interested:

      astrodark = { -- a table of overrides/changes when applying the astrotheme theme
        FloatBorder = { fg = "#cccccc" },
        NormalFloat = { bg = "#333333" },
        PMenu = { bg = "#333333" },
        PMenuSel = { bg = "#999999", fg = "#000000" },
      },
A-Lamia commented 4 months ago

I'd like to note, there is no wrong or right answer to what each individual feels is better for them, that's why a lot of time was spent to make things really easy to modify, a lot of time is spent on my side with real tooling to make sure as much parts of AstroThemes as possible is within scientifically acceptable contrast levels with most the importance put on text first, Thanks for your input though.

As a side note, you can also add borders in the AstroTheme config it's a bool toggle, if you go through the documentation for AstroTheme there is a lot of settings for you to use :).

NOTE: If the plugin it self however does not support borders then they will not be visable, that is outside of a Themes scope as we don't modify anything other then highlight related stuff.

lfilho commented 4 months ago

Hey @A-Lamia totally in agreement! And I thank for your efforts! That's why I'm trying the theme out to begin with! 😊

As for the bool toggle for borders, not sure what you meant: it is true by default and i didn't change it...

Here's the config I had to do to actually enable borders to Lazy and Mason (after reading their documentation, ideally and integrated theme like this would abstract this away):

on lazy_setup:

require("lazy").setup({
  {
    "AstroNvim/AstroNvim",
    [...]
    ui = { backdrop = 100, border = "rounded" },
    [...]
} --[[@as LazyConfig]])

anywhere in your plugins/:

return {
  {
    "williamboman/mason.nvim",
    opts = {
      ui = {
        border = "rounded",
      },
    },
  },
}

So maybe by setting the border = true in the theme, the theme should go ahead and do what the above for Lazy and Mason too?

Here's how Lazy looks now: CleanShot 2024-05-07 at 21 04 59

and mason: CleanShot 2024-05-07 at 21 05 38

I think even with just the borders (without my custom background), it would already be a big improvement. But again, as you mentioned, it's all a matter of preferences in the end ;)

Thanks again!

A-Lamia commented 4 months ago

That would be up to AstroNvim it self to abstract that out in to a global border toggle, we get in to really strange territory when themes are modifying plugin config settings. Potentially also overriding user preferences, Imagine you had put all that work just now to enable borders and a theme you downloaded disabled them, and now you need to fight with it for load order or visa versa. :)

SIDE NOTE: I attempted something like this with a global blend to make it easier on the end user, we ended up removing it because people didn't like it overwriting there own settings, it might have made it easier when using AstroTheme but with other themes now you needed to write more code to toggle different states.

lfilho commented 4 months ago

Yes, I agree it would have to be at the AstroNvim level, not the theme. The theme could then just customize colors, etc.

Regarding "people didn't like it overwriting there own settings", maybe an option wouldbe be to make it an opt-in config...