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

bug: terminal color too late #591

Closed
3 tasks done
cathaysia opened this issue Jul 9, 2024 · 0 comments · Fixed by #592
Closed
3 tasks done

bug: terminal color too late #591

cathaysia opened this issue Jul 9, 2024 · 0 comments · Fixed by #592
Labels
bug Something isn't working

Comments

@cathaysia
Copy link

Did you check docs and existing issues?

  • I have read all the tokyonight.nvim docs
  • I have searched the existing issues of tokyonight.nvim
  • I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

v0.10.0

Operating system/version

Linux dragon 6.9.7-200.fc40.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jun 27 18:11:45 UTC 2024 x86_64 GNU/Linux

Describe the bug

here:

vim.schedule(function()

delay the setting of terminal_colors, this results in the vim.g.terminal_color_0 not being set when the ColorScheme event is triggered.

Unfortunately my plugin currently relies on these values. I know tokyonight provides some APIs to let me get its color directly, but I have some other themes, so I am not inclined to use fixed colors.

Considering that the this function should be only run once, is a synchronous setup also acceptable?

Steps To Reproduce

  1. checkout main
  2. add log for nvim:
vim.api.nvim_create_autocmd({ 'ColorScheme' }, {
    callback = function()
        print(vim.g.terminal_color_0)
    end()

Expected Behavior

vim.g.terminal_color_0 != nil

Repro

-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath, })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  "folke/tokyonight.nvim",
  -- add any other plugins here
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here
@cathaysia cathaysia added the bug Something isn't working label Jul 9, 2024
@folke folke closed this as completed in 70c6334 Jul 9, 2024
georgeharker pushed a commit to georgeharker/tokyonight.nvim that referenced this issue Jul 9, 2024
folke pushed a commit that referenced this issue Jul 13, 2024
🤖 I have created a release *beep* *boop*
---


##
[4.5.0](v4.4.0...v4.5.0)
(2024-07-13)


### Features

* helpExample (checkhealth)
([7f41b0e](7f41b0e))


### Bug Fixes

* **fish:** use magenta for option color
([78cc1ae](78cc1ae))
* **nvim-tree:** corrected plugin name. Fixes
[#593](#593)
([66a272b](66a272b))
* **theme:** apply terminal colors right away. Fixes
[#591](#591)
([70c6334](70c6334))
* **treesitter:** make jsx tags the same as tsx. Closes
[#597](#597)
([468866d](468866d))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant