nix/home/config/nvim/module/config/Highlight.nix

50 lines
1.2 KiB
Nix
Raw Normal View History

{
2024-11-04 04:37:29 +03:00
config,
lib,
...
}: let
color = config.module.style.color;
mkHighlight = name: value: ''vim.api.nvim_set_hl(0, "${name}", ${lib.generators.toLua { multiline = false; asBindings = false; } value})'';
bg = {
bg = "#${color.bg.regular}";
};
selection = {
bg = "#${color.selection}";
bold = true;
fg = "#${color.bg.dark}";
2024-11-04 04:37:29 +03:00
};
transparent = {
bg = lib.generators.mkLuaInline "clear";
};
border = {
bg = lib.generators.mkLuaInline "clear";
fg = "#${color.accent}";
};
in {
text = ''
vim.api.nvim_create_autocmd({"ColorScheme", "VimEnter"}, {
group = vim.api.nvim_create_augroup('Color', {}),
pattern = "*",
callback = function ()
-- Background.
${mkHighlight "CursorLine" bg}
${mkHighlight "Pmenu" bg}
${mkHighlight "PmenuExtra" bg}
2024-11-04 04:37:29 +03:00
-- Selection.
${mkHighlight "Visual" selection}
${mkHighlight "PmenuSel" selection}
${mkHighlight "TelescopeSelection" selection}
2024-11-04 04:37:29 +03:00
-- Transparent.
${mkHighlight "NormalFloat" transparent}
2024-10-23 21:19:48 +03:00
2024-11-04 04:37:29 +03:00
-- Border.
${mkHighlight "FloatBorder" border}
${mkHighlight "FloatTitle" border}
${mkHighlight "TelescopeBorder" border}
end
})
'';
}