NvChad / base46

NvChad's base46 theme plugin with caching ( Total re-write )
Other
210 stars 203 forks source link

Toggle theme missing some colors from dark to light theme #206

Closed fabiodcorreia closed 1 year ago

fabiodcorreia commented 1 year ago

I created 2 themes under custom/themes/ as described on the documentation (catppuccin_frappe.lua and catppuccin_latte.lua) and I set both on chadrc.lua. And it works fine.

One thing that I noticed is that if toggle the theme from light to dark and back again to light some of the colors remain from the dark theme or get lost. For instance the status line filename and git brand and the buffer name on the tabs.

Light theme with correct colors:

image image

After I switch to dark

image image

Switching back to light

image image

Switching back o dark its all good but if I switch back to light again now the colors are the ones from dark theme.

image image

After this points I can toggle as many times as I want and the result is always wrong. I need to exit nvim open again a toggle the themes one to fix.

For some reason this only happens on the light theme, the dark is always good regardless how many combinations I do.

The themes can be found at the following links:

antoineco commented 1 year ago

lightbg is commented.

fabiodcorreia commented 1 year ago

lightbg is commented.

It's not used by the vscode_colored theme that I use. Anyway I tried with that uncommented and the result is the same.

antoineco commented 1 year ago

Found yesterday on Discord. The culprit is here:

https://github.com/NvChad/base46/blob/bad87b034430b0241d03868c3802c2f1a4e0b4be/lua/base46/integrations/statusline.lua#L9-L15

fabiodcorreia commented 1 year ago

I changed my local copy and I think this fix the problem but I don't if it's the best solution since I don't know much about lua.

local light_grey = colors.light_grey
local statusline_bg = colors.statusline_bg

if statusline_theme == "vscode" then
  statusline_bg = generate_color(colors.statusline_bg, 1)
  light_grey = generate_color(colors.light_grey, 20)
elseif statusline_theme == "vscode_colored" then
  statusline_bg = generate_color(colors.statusline_bg, 1)
  light_grey = generate_color(colors.light_grey, 25)
end

So I created 2 local variables to hold the lighter version of the color instead of setting it on the colors variable. After that I replace all the call of colors.statusline_bg and colors.light_grey with the local variable. I tried several times and replicate the issue but I can't reproduce it anymore.

RichterMaximilian commented 1 year ago

I still have the problem even after the fix.

I use the one_light theme and the vscode_colored statusline. After toggling the theme back and forth, the file name and git brand don't change its color back to the light theme.

It is fixed for the tabs though.

siduck commented 1 year ago

@fabiodcorreia

fabiodcorreia commented 1 year ago

@siduck I think the issue is with the themes, for example the issue appears for onedark and one_light but for everforest and everforest_light it works fine, GitHub Light and Dark also doesn't work but Grovbox looks good.

siduck commented 1 year ago

https://github.com/NvChad/base46/commit/66d1fb4c28500a4e6ad8a0fefcec62302b97ceab