Skip to content

Conversation

@Jint-lzxy
Copy link
Collaborator

@Jint-lzxy Jint-lzxy commented Jul 22, 2022

Once finished and merged, this would close #159

TODOs

Palettes

  • Light (a.k.a latte) pending
  • Dark (a.k.a mocha)

Integrations

  • Treesitter
  • Neovimbase
  • Editor
  • Syntax
  • Terminal
  • Dashboard
  • Indent_blankline
  • Lsp_trouble
  • Neogit
  • Nvimtree
  • Telescope
  • Bufferline
  • Gitsigns
  • Markdown
  • Symbols_outline
  • Which_key
  • Cmp
  • Fern
  • Hop
  • Lsp_saga
  • Native_lsp
  • Notify
  • Ts_rainbow
  • Dapui

Additional Information

What is the current state of this PR?

  • This PR is currently a draft. It cannot be merged until being marked as ready for review.

How come?

  • In this way, the latest progress of the changes can be tracked.

Why making these changes?

Recently catppuccin has been updated very frequently, many bugs have been gradually fixed, and the project structure and configuration methods have both become clearer. Through upgrading and manually changing the configs, we can not only enjoy the functions and fixes brought by the latest version & commits, but also continue to use the previous color palettes.

When will this PR be marked as ready for review?

  • There are many changes needed to take place (mostly integration stuffs), and we also need to consider readability, efficiency (startup time), final effects and other factors. Probably next month?

What files (or lines) will be changed?

  • The changes will all be made inside lua/modules/ui/config.lua, a tiny exception is for dapui (at lua/modules/editor/config.lua), since we need to override nvim-dap's default highlight groups, AFTER requiring nvim-dap.

Then, what features will be changed / added? Can you talk about this more in detail?

  1. Catppuccin is upgraded to v0.2
  2. The colors for mocha is being modified to previous v0.1 one. I choose mocha because it has the FEWEST changes in colors.
  3. The integrations that catppuccin would affect (a.k.a. highlight groups) would be modified as far as I can to make it look like the original one.
  4. Settings are changed to make catppuccin work correctly. (See MIGRATION GUIDE (follow if your config magically broke!) catppuccin/nvim#178 for details)

Code details?

  1. Color changes are taken place inside the color_overrides table.
  2. Integration changes are taken place inside the highlight_overrides table.
  3. See the actual code for misc changes.

Looks like there're many additions, will it affect performance?

  • Currently, there's only a negligible change in performance. But if it would cause an impact in future changes, I will try my best to solve it :).

Any other notes?

  • When the PR is making some step forward, I will post a comment that can help you understand what's happening behind the scene!
  • If you have any questions regarding the changes (or other stuffs), feel free to post a comment! I'll try my best to answer it!

@rewhile
Copy link
Contributor

rewhile commented Jul 26, 2022

@Jint-lzxy Heya, maintainer of catppuccin here, I saw your pr and thought it would be a good idea to include per flavour custom highlights: https://github.com/catppuccin/nvim#overwriting-highlight-groups

Note that custom_highlights will be link to highlight_overrides.all if is set

Here is a sneak peak, hope this is useful to you 👍🏻

local ucolors = require "catppuccin.utils.colors"
local latte = require("catppuccin.palettes").get_palette "latte"
local frappe = require("catppuccin.palettes").get_palette "frappe"
local macchiato = require("catppuccin.palettes").get_palette "frappe"
local mocha = require("catppuccin.palettes").get_palette "mocha"

vim.g.catppuccin_flavour = "macchiato"
local colors = require("catppuccin.palettes").get_palette() -- return vim.g.catppuccin_flavour palette

require("catppuccin").setup {
	highlight_overrides = {
		all = {
			CmpBorder = { fg = "#3e4145" },
		},
		latte = {
			Normal = { fg = ucolors.darken(latte.base, 0.7, latte.mantle) },
		},
		frappe = {
			TSConstBuiltin = { fg = frappe.peach, style = {} },
			TSConstant = { fg = frappe.sky },
			TSComment = { fg = frappe.surface2, style = { "italic" } },
		},
		macchiato = {
			LineNr = { fg = macchiato.overlay1 }
		},
		mocha = {
			Comment = { fg = mocha.flamingo },
		},
	},
}

@Jint-lzxy
Copy link
Collaborator Author

Thanks @nullchilly :) Great suggestion 👍

btw, thank you for the great efforts in offering us this gorgeous theme! Recent changes have made it even more intuitive and easier to use!

@jczhang02
Copy link
Contributor

Hey, @Jint-lzxy , your efforts for integrating the theme into nvimdots is fantastic! Hope it will be finished quickly! I can't wait to use the new version theme.

@Jint-lzxy
Copy link
Collaborator Author

Jint-lzxy commented Jul 31, 2022

Thanks @jczhang02 :)

I was working on base hl configs for nvim itself recently, which involves modification of various colors and adjustment for v0.2's new highlight groups (so that they won't conflict with old hls), but everything is still on track! I'll finish this asap 👍

@Jint-lzxy Jint-lzxy marked this pull request as ready for review August 8, 2022 01:21
@Jint-lzxy
Copy link
Collaborator Author

Jint-lzxy commented Aug 8, 2022

@ayamir 可以帮忙先测试和review一下嘛~(康康有啥问题),现在绝大多数的更改都已经完成啦

  • ssh: git clone [email protected]:Jint-lzxy/nvimdots.git
  • https: git clone https://github.com/Jint-lzxy/nvimdots.git
  • github CLI: gh pr checkout 163

建议先不要merge,还有一些细枝末节的更改和确认没做~

启动时间在我的配置下没有很大的变化(甚至还快了些,因为catppuccin优化了项目结构),使用:CatppuccinCompile经过测试可以更快地完成加载(设置catppuccin的时间在~3ms左右,能节省~20ms的时间),数据存在$HOME/.cache/nvim/catppuccin目录下,但更改过设置后需要重新编译(*这些说明最后会写一个doc的~)

一些问题

  • 这些更改应该都需要写doc(例如关于编译),您建议放到哪里?
  • 在我这里测试的配置有些不同,应该需要在您那边也测试一遍(例如搜索,启动时间,替换,看lualine的颜色,bufferline有没有颜色不协调这些日常使用中会经常碰到的)
  • 数字没有设置bold, italic有意的,但原设置是有粗斜体这个属性的,您康康哪个更好?
  • 好像还有但突然忘记了2333想起来了再加

Q&A

  • Q: 为什么要有下面这个函数?
local function getModifiedPalette()
  • A: 因为我们在覆盖高亮组 (也即获取调色板) 的时候对mocha的颜色做出的更改还没有被真正写入,而在仅调用一次setup的情况下,我们传入的颜色已经被解析了(例如,cp.pink -> "#F5C2E7"),所以完全不可能获得更改后的调色板,因此需要手动设置。

  • Q: 这次都改了些啥?

  • A: 这次仅仅修改了mocha这个调色板的设置 (一些设置被注释掉了,因为这和 v0.2没有冲突,但为了防止后期的再次调整先放在这里)。其余的配色均没有触及,切换的话会仍然是未更改的配色,这是有意为之的。同时还修改了对DAP的集成的配色(见注释),以及一些其他参数的更改(例如传入数据要用表了)

  • Q: 对亮色调色板的支持?

  • A: 对latte目前还没有做出调整(因为现有配色无法直接移植到亮色背景下,会有冲突,这估计也是catppuccin改集成的原因(?)),但如果确实需要会继续去实现的~。(之前我记得catppuccin好像也没有亮色调色板)目前还是建议使用一些专门用于亮色背景下的配色~

  • Q: 有没有调色板的成品照片?

  • A: 当然有啦!而且对mocha的配色有了一些较大的调整(v0.2的色调偏黑了,应该是混合过),详见:

截屏2022-08-08 08 36 14

  • Q: 有没有成品截图?

  • A: 有,在这!
    LW
    LW2

  • Q: 有没有前后对比图?

    • A: 有,都准备好啦!
    • v0.1:
      original
    • Current:
      current

@jczhang02
Copy link
Contributor

很棒的pr! 我也会去测试一到两天,看看有什么问题没有。
另外,对于您说的问题,有一些可能的回复:

  • doc的话也许放到wiki中一个新的章节或者use directly中会较好;
  • 数字如果设置italic可能会有观感问题,可以bold或者维持现状。

@Jint-lzxy
Copy link
Collaborator Author

Jint-lzxy commented Aug 8, 2022

@ayamir @jczhang02 I plan to add a hook that could automatically compile Catppuccin when Packer compiles, so as to avoid unnecessary issues. What's your opinion? / 我打算加一个:PackerCompile时自动编译Catppuccin的钩子,这样的话会少很多不必要的issue,你们觉得如何?

Code:

vim.api.nvim_create_autocmd("User", {
	pattern = "PackerCompileDone",
	callback = function()
		vim.cmd "CatppuccinCompile"
		vim.defer_fn(function()
			vim.cmd "colorscheme catppuccin"
		end, 0) -- Deferred for live reloading
	end
})

Copy link
Contributor

@jczhang02 jczhang02 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fantastic work! I reviewed commits and set to normal comment wait for @ayamir 's review.

@ayamir
Copy link
Owner

ayamir commented Aug 8, 2022

The appearance is ok, I can't differ the old one with this.

  • About the doc of recompilation, I prefer to add it to wiki and use command hook both.
  • About the number's appearance, it's suitable so no need to set it to bold or italic.

Thanks for your awesome PR, I will merge it after you add hook function.

@Jint-lzxy
Copy link
Collaborator Author

Jint-lzxy commented Aug 8, 2022

@ayamir We're all set 👍

  • The auto-compile hook is implemented inside lua/core/init.lua to avoid creating autocmd every time we compile catppuccin.
  • The auto-compile hook is now implemented inside catppuccin's own config function. Many thanks to @nullchilly.
  • Doc will be completed soon!

@rewhile
Copy link
Contributor

rewhile commented Aug 8, 2022

@Jint-lzxy This is also an option

local packer = vim.api.nvim_create_augroup("Catppuccin", { clear = true })

vim.api.nvim_create_autocmd("User", {
	group = packer,
	pattern = "PackerCompileDone",
	callback = function()
		require("catppuccin").compile()
		vim.defer_fn(function() vim.cmd "colorscheme catppuccin" end, 0)
	end,
})

@Jint-lzxy Jint-lzxy marked this pull request as draft August 8, 2022 12:46
@Jint-lzxy
Copy link
Collaborator Author

Thanks @nullchilly 👍

@Jint-lzxy Jint-lzxy marked this pull request as ready for review August 8, 2022 13:00
@ayamir ayamir merged commit e1b3c0e into ayamir:main Aug 9, 2022
vkingw pushed a commit to vkingw/nvimdots that referenced this pull request Feb 7, 2023
BREAKING CHANGE: Catppuccin is upgraded to v0.2, but color palette is preserved (mocha)
YanTree pushed a commit to YanTree/nvim that referenced this pull request Apr 9, 2023
BREAKING CHANGE: Catppuccin is upgraded to v0.2, but color palette is preserved (mocha)
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 this pull request may close these issues.

Update catppuccin to V0.2 (latest)?

4 participants