From 28b30353d836ffc7933dd58613f57abcf6ad318c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thea=20Sch=C3=B6bl?= Date: Thu, 25 Apr 2024 01:18:54 +0200 Subject: [PATCH] feat: sick theming --- .../programs/nixvim/custom-highlights.lua | 65 ------------- .../home-manager/programs/nixvim/default.nix | 27 +----- .../programs/nixvim/extra-config.lua | 9 -- modules/nixos/theming/matugen.nix | 14 +++ modules/nixos/theming/nvim.vim | 96 +++++++++++++++++++ 5 files changed, 111 insertions(+), 100 deletions(-) delete mode 100644 modules/home-manager/programs/nixvim/custom-highlights.lua create mode 100644 modules/nixos/theming/nvim.vim diff --git a/modules/home-manager/programs/nixvim/custom-highlights.lua b/modules/home-manager/programs/nixvim/custom-highlights.lua deleted file mode 100644 index 0ee9a95..0000000 --- a/modules/home-manager/programs/nixvim/custom-highlights.lua +++ /dev/null @@ -1,65 +0,0 @@ -function(colors) - return { - CmpItemKindCopilot = { fg = colors.teal }, - CmpItemKindNpm = { fg = colors.maroon }, - - -- IntelliJ Theme - Constant = { fg = colors.mauve }, - Character = { link = "Keyword" }, - Number = { fg = colors.sapphire }, - Boolean = { link = "Keyword" }, - Identifier = { fg = colors.text }, - Function = { fg = colors.blue }, - Statement = { fg = colors.text }, - Conditional = { link = "Keyword" }, - Repeat = { link = "Keyword" }, - Label = { link = "Keyword" }, - Operator = { fg = colors.text }, - Keyword = { fg = colors.peach }, - Exception = { link = "Keyword" }, - Include = { link = "Keyword" }, - Structure = { fg = colors.yellow }, - Type = { fg = colors.teal }, - - SpellBad = { sp = colors.green, style = { "underdotted" } }, - SpellCap = { sp = colors.green, style = { "underdotted" } }, - SpellLocal = { sp = colors.green, style = { "underdotted" } }, - SpellRare = { sp = colors.green, style = { "underdotted" } }, - - ["@constructor"] = { link = "Keyword" }, - ["@constructor.typescript"] = { link = "@constructor" }, - ["@parameter"] = { link = "Identifier" }, - - ["@tag"] = { link = "Structure" }, - ["@tag.delimiter"] = { link = "Structure" }, - ["@tag.attribute"] = { fg = colors.mauve, style = { "italic" } }, -- Constant - - ["@keyword.function"] = { link = "Keyword" }, - ["@keyword.operator"] = { link = "Keyword" }, - ["@keyword.return"] = { link = "Keyword" }, - ["@keyword.export"] = { link = "Keyword" }, - - ["@punctuation.special"] = { link = "Operator" }, - ["@conditional.ternary"] = { link = "Operator" }, - - ["@type.builtin"] = { link = "Keyword" }, - ["@variable.builtin"] = { link = "Keyword" }, - ["@lsp.typemod.class.defaultLibrary"] = { fg = colors.yellow, style = { "bold" } }, -- Structure - ["@lsp.typemod.variable.defaultLibrary"] = { fg = colors.mauve, style = { "bold" } }, -- Constant - ["@lsp.typemod.function.defaultLibrary"] = { fg = colors.blue, style = { "bold" } }, -- Function - - ["@variable"] = { link = "Constant" }, - ["@field"] = { link = "Constant" }, - ["@label.json"] = { link = "Constant" }, - ["@label.jsonc"] = { link = "Constant" }, - ["@property"] = { link = "Constant" }, - ["@property.typescript"] = { link = "@property" }, - ["@lsp.type.property"] = { link = "Constant" }, - ["@lsp.type.interface"] = { link = "Structure" }, - ["@lsp.type.namespace"] = { link = "Structure" }, - ["@attribute.typescript"] = { link = "Structure" }, - - ["@lsp.mod.local"] = { fg = colors.text }, - ["@lsp.mod.readonly"] = { style = { "italic" } }, - } -end diff --git a/modules/home-manager/programs/nixvim/default.nix b/modules/home-manager/programs/nixvim/default.nix index d9b1aaa..359c324 100644 --- a/modules/home-manager/programs/nixvim/default.nix +++ b/modules/home-manager/programs/nixvim/default.nix @@ -2,7 +2,7 @@ let darkman = pkgs.vimUtils.buildVimPlugin { name = "darkman"; - src = pkgs.buildGoModule rec { + src = pkgs.buildGoModule { pname = "darkman.nvim"; version = "0.0.1"; vendorHash = "sha256-HpyKzvKVN9hVRxxca4sdWRo91H32Ha9gxitr7Qg5MY8="; @@ -81,36 +81,11 @@ in providers.wl-copy.enable = true; }; - extraConfigVim = '' - if !exists("g:neovide") - hi Normal guibg=NONE ctermbg=NONE - endif - set noshowmode - ''; - extraConfigLua = builtins.readFile ./extra-config.lua; - colorschemes.catppuccin = { - enable = true; - settings = { - term_colors = true; - transparent_background = true; - background = { - dark = "frappe"; - light = "latte"; - }; - integrations.native_lsp.underlines = { - errors = [ "undercurl" ]; - warnings = [ "undercurl" ]; - }; - custom_highlights = builtins.readFile ./custom-highlights.lua; - }; - }; - plugins = { lualine = { enable = true; - theme = "catppuccin"; globalstatus = true; sectionSeparators = { left = ""; diff --git a/modules/home-manager/programs/nixvim/extra-config.lua b/modules/home-manager/programs/nixvim/extra-config.lua index ff7da83..c225b1f 100644 --- a/modules/home-manager/programs/nixvim/extra-config.lua +++ b/modules/home-manager/programs/nixvim/extra-config.lua @@ -4,15 +4,6 @@ require("rest-nvim").setup({}) require("actions-preview").setup({}) if vim.g.neovide then - vim.api.nvim_create_autocmd("ColorScheme", { - pattern = "*", - callback = function() - local flavour = require("catppuccin").options.background[vim.o.background] - local palette = require("catppuccin.palettes").get_palette(flavour) - vim.cmd("hi Normal guibg=" .. palette.base) - vim.cmd("set pumblend=100") - end, - }) -- no idea why this is needed vim.opt.linespace = -1 end diff --git a/modules/nixos/theming/matugen.nix b/modules/nixos/theming/matugen.nix index 8aab146..ac5b67c 100644 --- a/modules/nixos/theming/matugen.nix +++ b/modules/nixos/theming/matugen.nix @@ -44,9 +44,19 @@ in red = "#ff0000"; green = "#00ff00"; yellow = "#ffff00"; + orange = "#ff8000"; blue = "#0000ff"; magenta = "#ff00ff"; cyan = "#00ffff"; + + warn = { + color = "#ffff00"; + blend = false; + }; + ok = { + color = "#00ff00"; + blend = false; + }; }; }; @@ -55,6 +65,10 @@ in input_path = ./kitty.conf; output_path = "${homeCfg.xdg.configHome}/kitty/theme.conf"; }; + nvim = { + input_path = ./nvim.vim; + output_path = "${homeCfg.xdg.configHome}/nvim/colors/matugen.vim"; + }; }; }; }; diff --git a/modules/nixos/theming/nvim.vim b/modules/nixos/theming/nvim.vim new file mode 100644 index 0000000..ccd2897 --- /dev/null +++ b/modules/nixos/theming/nvim.vim @@ -0,0 +1,96 @@ +if exists(g:neovide) + hi Normal guibg={{colors.surface.default.hex}} guifg={{colors.on_surface.default.hex}} + set pumblend=100 +else + hi Normal ctermbg=NONE guibg=NONE guifg={{colors.on_surface.default.hex}} + set noshowmode +end + +hi CmpItemKindCopilot guifg={{colors.cyan.default.hex}} +hi CmpItemKindNpm guifg={{colors.red.default.hex}} + +hi Error guibg={{colors.error_container.default.hex}} guifg={{colors.on_error_container.default.hex}} +hi ErrorMsg guibg={{colors.error_container.default.hex}} guifg={{colors.on_error_container.default.hex}} + +hi DiagnosticError guifg={{colors.error.default.hex}} +hi DiagnosticWarn guifg={{colors.warn.default.hex}} +hi DiagnosticInfo guifg={{colors.blue.default.hex}} +hi DiagnosticHint guifg={{colors.outline.default.hex}} +hi DiagnosticOk guifg={{colors.ok.default.hex}} + +hi DiagnosticUnderlineError gui=undercurl guisp={{colors.error.default.hex}} +hi DiagnosticUnderlineWarn gui=undercurl guisp={{colors.warn.default.hex}} +hi DiagnosticUnderlineInfo gui=undercurl guisp={{colors.blue.default.hex}} +hi DiagnosticUnderlineHint gui=undercurl guisp={{colors.outline.default.hex}} +hi DiagnosticUnderlineOk gui=undercurl guisp={{colors.ok.default.hex}} +hi DiagnosticDeprecated gui=strikethrough guisp={{colors.error.default.hex}} + +hi NonText guifg={{colors.outline_variant.default.hex}} +hi LineNr guifg={{colors.outline_variant.default.hex}} +hi CursorLineNr guifg={{colors.on_surface.default.hex}} +hi CursorColumn guifg={{colors.on_surface.default.hex}} +hi CursorLine guifg={{colors.on_surface.default.hex}} +hi SignColumn guibg=none guifg={{colors.on_surface.default.hex}} + +hi IblScope guifg={{colors.on_surface.default.hex}} +hi @ibl.scope.char.1 guifg={{colors.on_surface.default.hex}} +hi @ibl.scope.underline.1 guisp={{colors.on_surface.default.hex}} + +hi Comment guifg={{colors.outline.default.hex}} +hi Todo guibg={{colors.yellow_container.default.hex}} guifg={{colors.on_yellow_container.default.hex}} +hi def link @comment.todo Todo +hi def link @comment.error Error + +hi String guifg={{colors.green.default.hex}} + +hi Identifier guifg={{colors.on_surface.default.hex}} +hi Statement gui=bold guifg={{colors.on_surface.default.hex}} +hi def link Operator Normal +hi @conditional.ternary guifg={{colors.on_surface.default.hex}} +hi def link @keyword.conditional.ternary Operator +hi def link Delimiter Normal +hi def link @lsp.mod.local Normal +hi def link @parameter Identifier + +hi @lsp.mod.defaultLibrary gui=bold +hi @lsp.mod.readonly gui=italic + +hi Constant guifg={{colors.magenta.default.hex}} +hi def link @variable Constant +hi def link @field Constant +hi def link @property @field +hi def link @label.json @property +hi def link @label.jsonc @label.json +hi def link @property.typescript @property +hi def link @lsp.type.property @property + +hi def link @lsp.type.variable Constant +hi def link @lsp.typemod.variable.local Identifier + +hi Keyword guifg={{colors.orange.default.hex}} +hi Special guifg={{colors.orange.default.hex}} +hi def link Character Keyword +hi def link Boolean Keyword +hi def link Repeat Keyword +hi def link Label Keyword +hi def link Exception Keyword +hi def link Include Keyword +hi def link Conditional Keyword +hi def link @type.builtin Keyword + +hi Number guifg={{colors.cyan.default.hex}} +hi Function guifg={{colors.cyan.default.hex}} + +hi @attribute guifg={{colors.yellow.default.hex}} +hi Structure guifg={{colors.yellow.default.hex}} +hi def link PreProc Structure +hi def link Tag Structure +hi Type gui=none guifg={{colors.blue.default.hex}} +hi def link @lsp.type.interface Type + +hi IlluminatedWordText gui=none guibg={{colors.surface_container_highest.default.hex}} +hi IlluminatedWordRead gui=none guibg={{colors.surface_container_highest.default.hex}} +hi IlluminatedWordWrite gui=none guibg={{colors.surface_container_highest.default.hex}} +hi MatchParen gui=none guibg={{colors.surface_container_highest.default.hex}} + +hi Visual gui=bold guifg={{colors.on_primary.default.hex}} guibg={{colors.primary.default.hex}}