Giter VIP home page Giter VIP logo

Comments (7)

rgambord avatar rgambord commented on August 24, 2024

This has been a bug for a long, long time. I was able to fix it in an older commit with this patch:

index f785fdb..27d8282 100644
--- a/lua/catppuccin/lib/highlighter.lua
+++ b/lua/catppuccin/lib/highlighter.lua
@@ -36,7 +36,7 @@ function M.load(theme)
 	end
 	g.colors_name = "catppuccin"
 
-	M.properties(theme.properties, "o")
+	-- M.properties(theme.properties, "o")
 	M.syntax(vim.tbl_deep_extend("keep", theme.custom_highlights, theme.integrations, theme.syntax, theme.editor))
 
 	if require("catppuccin.config").options["term_colors"] then

Just updated tonight and noticed it's broken still. That module has also been deprecated.

from nvim.

rgambord avatar rgambord commented on August 24, 2024

You can work around the issue by loading the color scheme after the background option is set,

vim.api.nvim_create_autocmd("OptionSet", {
	pattern = "background",
	callback = function()
 		vim.cmd("Catppuccin " .. (vim.v.option_new == "light" and "latte" or "mocha"))
	end,
})

Edit: If you are using something like lualine that references catppuccin, you'll also want to put its setup in the callback function, or the colors will be based on mocha (?).

from nvim.

nullchilly avatar nullchilly commented on August 24, 2024

I added a quick fix

Try this:

require("catppuccin").setup { flavour = "auto" }
auto_flavour.mp4

from nvim.

iruzo avatar iruzo commented on August 24, 2024

@nullchilly

I gave that a try and something weird happens:

  • If I set my GNOME theme as Light, Neovim will open with CTP latte (everything fine with this)
  • If I set my GNOME theme to Dark, Neovim will not load the CTP theme (well, the theme is loaded, it just not being applied)
    • The bg var is set to dark correctly, tho
    • I can manually the theme doing colorscheme catppuccin-[flavour]
nvim-issue.webm

from nvim.

mrcsmcln avatar mrcsmcln commented on August 24, 2024

Super new to Neovim but I think this is happening for me as well. With flavour = "auto" set, the light theme loads just fine but the dark theme doesn't look right. Running :colorscheme catppuccin-[flavour] produces the ideal result.

I'm using macOS / AstroNvim.

from nvim.

goulf-3m avatar goulf-3m commented on August 24, 2024
  if (option_was_set("bg") || strequal(p_bg, value)) {
    // background is already set... ignore
    return;
  }
  if (starting) {
    // Wait until after startup, so OptionSet is triggered.
    do_cmdline_cmd((value[0] == 'l')
                   ? "autocmd VimEnter * ++once ++nested :lua if not vim.api.nvim_get_option_info2('bg', {}).was_set then vim.o.bg = 'light' end"
                   : "autocmd VimEnter * ++once ++nested :lua if not vim.api.nvim_get_option_info2('bg', {}).was_set then vim.o.bg = 'dark' end");
  } else {

Referring to the neovim 0.9.5 code, an OptionSet event won't happen if:

  1. bg was explicitly set,
  2. or term bg is dark.

I guess, CAT should respect, but not depend on, OptionSet events, when "auto" is used.
Preferably, monitor bg change and respond automatically without restarting nvim.

from nvim.

iruzo avatar iruzo commented on August 24, 2024

@nullchilly

I can confirm that with the recent changes, using require("catppuccin").setup { flavour = "auto" }, it works.
I'm gonna close this since it is resolved with that change. In case flavour = "auto" is not already documented on the README, I will do the PR myself.

Tysm guys !

from nvim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.