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

57 lines
1.3 KiB
Nix
Raw Normal View History

{ config, lib, ... }:
let
color = config.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}";
fg = "#${color.fg.dark}";
bold = true;
};
transparent = {
bg = lib.generators.mkLuaInline "clear";
};
2024-10-23 21:19:48 +03:00
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 ()
2024-10-23 21:19:48 +03:00
-- Background.
${mkHighlight "CursorLine" bg}
2024-10-23 21:19:48 +03:00
${mkHighlight "Pmenu" bg}
${mkHighlight "PmenuExtra" bg}
-- Selection.
${mkHighlight "Visual" selection}
2024-10-23 21:19:48 +03:00
${mkHighlight "PmenuSel" selection}
${mkHighlight "TelescopeSelection" selection}
-- Transparent.
${mkHighlight "NormalFloat" transparent}
2024-10-23 21:19:48 +03:00
-- Border.
${mkHighlight "FloatBorder" border}
${mkHighlight "FloatTitle" border}
${mkHighlight "TelescopeBorder" border}
end
})
'';
}