Add theme support to nixCats

This commit is contained in:
2025-11-30 18:51:56 +01:00
parent b73ba4dfa3
commit 383d8bd0c6
3 changed files with 113 additions and 56 deletions

View File

@@ -1,7 +1,19 @@
{ inputs, config, ... }:
{
inputs,
lib,
config,
...
}:
let
inherit (inputs.nixCats) utils;
luaPath = ./.;
themeConfig =
config.theme.neovim or {
plugin = null;
setup = "";
};
categoryDefinitions =
{ pkgs, ... }:
{
@@ -47,11 +59,13 @@ let
};
startupPlugins = {
general = with pkgs.vimPlugins; [
lz-n
plenary-nvim
catppuccin-nvim
];
general =
with pkgs.vimPlugins;
[
lz-n
plenary-nvim
]
++ (lib.optional (themeConfig.plugin != null) themeConfig.plugin);
};
optionalPlugins = {
@@ -86,7 +100,9 @@ let
render-markdown-nvim
colorful-menu-nvim
];
};
sharedLibraries = {
@@ -132,6 +148,13 @@ let
nixos_options = ''(builtins.getFlake "path://${config.var.configDirectory}").nixosConfigurations.${toString config.var.hostname}.options'';
home_manager_options = ''(builtins.getFlake "path://${config.var.configDirectory}").nixosConfigurations.${toString config.var.hostname}.options.home-manager.users.type.getSubOptions []'';
};
themeSetup = themeConfig.setup;
# Pass only base00-base0F to neovim
stylixColors = lib.filterAttrs (
k: v: builtins.match "base0[0-9A-F]" k != null
) config.lib.stylix.colors.withHashtag;
};
};

View File

@@ -1,49 +1,73 @@
require("lz.n").load({
-- {
-- "catppuccin-nvim",
-- event = "VimEnter",
-- after = function()
-- require("catppuccin").setup({
-- flavour = "mocha",
-- term_colors = true,
-- dim_inactive = {
-- enabled = true,
-- shade = "dark",
-- percentage = 0.15,
-- },
-- integrations = {
-- gitsigns = true,
-- telescope = true,
-- treesitter = true,
-- treesitter_context = true,
-- markdown = true,
-- which_key = true,
-- blink_cmp = {
-- style = "bordered",
-- },
-- },
--
-- native_lsp = {
-- enabled = true,
-- virtual_text = {
-- errors = { "italic" },
-- hints = { "italic" },
-- warnings = { "italic" },
-- information = { "italic" },
-- },
-- underlines = {
-- errors = { "underline" },
-- hints = { "underline" },
-- warnings = { "underline" },
-- information = { "underline" },
-- },
-- inlay_hints = {
-- background = true,
-- },
-- },
-- })
--
-- vim.cmd.colorscheme("catppuccin")
-- end,
-- },
{
"catppuccin-nvim",
"theme-loader",
event = "VimEnter",
after = function()
require("catppuccin").setup({
flavour = "mocha",
term_colors = true,
dim_inactive = {
enabled = true,
shade = "dark",
percentage = 0.15,
},
integrations = {
gitsigns = true,
telescope = true,
treesitter = true,
treesitter_context = true,
markdown = true,
which_key = true,
blink_cmp = {
style = "bordered",
},
},
load = function()
local theme_code = nixCats.extra("themeSetup")
native_lsp = {
enabled = true,
virtual_text = {
errors = { "italic" },
hints = { "italic" },
warnings = { "italic" },
information = { "italic" },
},
underlines = {
errors = { "underline" },
hints = { "underline" },
warnings = { "underline" },
information = { "underline" },
},
inlay_hints = {
background = true,
},
},
})
vim.cmd.colorscheme("catppuccin")
if theme_code and theme_code ~= "" then
local func, err = loadstring(theme_code)
if func then
func()
else
print("Error loading theme code: " .. err)
end
else
local colors = nixCats.extra("stylixColors")
if colors then
require("lz.n").trigger_load("mini.nvim")
require("mini.base16").setup({
palette = colors,
})
end
end
end,
},
{