diff --git a/outputs/lib/color/utils.nix b/outputs/lib/color/utils.nix index 894a9d3..47cff82 100644 --- a/outputs/lib/color/utils.nix +++ b/outputs/lib/color/utils.nix @@ -122,6 +122,8 @@ header = args.neutrals."800"; footer = args.neutrals."800"; menu = args.neutrals."800"; + selection = args.neutrals."650"; + dimmed = args.neutrals."850"; }; border = { base = args.neutrals."650"; @@ -164,6 +166,8 @@ header = args.neutrals."150"; footer = args.neutrals."150"; menu = args.neutrals."150"; + selection = args.neutrals."300"; + dimmed = args.neutrals."200"; }; border = { base = args.neutrals."800"; diff --git a/outputs/pkgs/ook-vim/config/plugins/statusline.nix b/outputs/pkgs/ook-vim/config/plugins/statusline.nix index c9c4216..b60c12c 100644 --- a/outputs/pkgs/ook-vim/config/plugins/statusline.nix +++ b/outputs/pkgs/ook-vim/config/plugins/statusline.nix @@ -2,6 +2,7 @@ vim.statusline.lualine = { enable = true; activeSection = { + # most of this are the default values provided by nvf a = [ #lua '' diff --git a/outputs/pkgs/ook-vim/default.nix b/outputs/pkgs/ook-vim/default.nix index 40ad2fa..0196c62 100644 --- a/outputs/pkgs/ook-vim/default.nix +++ b/outputs/pkgs/ook-vim/default.nix @@ -1,11 +1,12 @@ { inputs, pkgs, + hozen, ... }: let ooks-vim = inputs.nvf.lib.neovimConfiguration { inherit pkgs; - extraSpecialArgs = {inherit inputs;}; + extraSpecialArgs = {inherit inputs hozen;}; modules = [ ./config ./modules diff --git a/outputs/pkgs/ook-vim/modules/plugins/default.nix b/outputs/pkgs/ook-vim/modules/plugins/default.nix index ccd4904..18f7c03 100644 --- a/outputs/pkgs/ook-vim/modules/plugins/default.nix +++ b/outputs/pkgs/ook-vim/modules/plugins/default.nix @@ -3,5 +3,6 @@ ./gruvbox-material ./telescope ./obsidian + ./theme ]; } diff --git a/outputs/pkgs/ook-vim/modules/plugins/theme/config.nix b/outputs/pkgs/ook-vim/modules/plugins/theme/config.nix new file mode 100644 index 0000000..ef7872a --- /dev/null +++ b/outputs/pkgs/ook-vim/modules/plugins/theme/config.nix @@ -0,0 +1,49 @@ +{ + config, + lib, + pkgs, + ... +}: let + inherit (lib) mkIf; + inherit (lib.nvim.dag) entryBefore; + inherit (lib.nvim.lua) toLuaObject; + + cfg = config.vim.theme.custom; + + themePlugin = pkgs.vimUtils.buildVimPlugin { + inherit (cfg) name; + src = pkgs.writeTextDir "colors/${cfg.name}.lua" '' + local M = {} + M.highlights = ${toLuaObject cfg.highlights} + + local function set_groups() + for group, settings in pairs(M.highlights) do + vim.api.nvim_set_hl(0, group, settings) + end + end + + function M.colorscheme() + vim.api.nvim_command("hi clear") + if vim.fn.exists("syntax_on") then + vim.api.nvim_command("syntax reset") + end + + vim.o.termguicolors = true + vim.g.colors_name = "${cfg.name}" + + set_groups() + end + + return M.colorscheme() + ''; + }; +in { + config = mkIf cfg.enable { + vim = { + startPlugins = [themePlugin]; + luaConfigRC.customTheme = '' + vim.cmd.colorscheme("${cfg.name}") + ''; + }; + }; +} diff --git a/outputs/pkgs/ook-vim/modules/plugins/theme/custom-theme.nix b/outputs/pkgs/ook-vim/modules/plugins/theme/custom-theme.nix new file mode 100644 index 0000000..c666826 --- /dev/null +++ b/outputs/pkgs/ook-vim/modules/plugins/theme/custom-theme.nix @@ -0,0 +1,103 @@ +{lib, ...}: let + inherit (lib) mkOption mkEnableOption; + inherit (lib.types) nullOr str bool attrsOf submodule; + + highlightOpts = submodule { + options = { + # https://neovim.io/doc/user/api.html#nvim_set_hl() + fg = mkOption { + type = nullOr str; + default = null; + description = "Foreground color"; + }; + bg = mkOption { + type = nullOr str; + default = null; + description = "Background color"; + }; + sp = mkOption { + type = nullOr str; + default = null; + description = "SP color"; + }; + blend = mkOption { + type = nullOr bool; + default = null; + description = "Blend attribute"; + }; + bold = mkOption { + type = nullOr bool; + default = null; + description = "Italic attribute"; + }; + standout = mkOption { + type = nullOr bool; + default = null; + description = "Standout attribute"; + }; + underline = mkOption { + type = nullOr bool; + default = null; + description = "underline attribute"; + }; + undercurl = mkOption { + type = nullOr bool; + default = null; + description = "Undercurl attribute"; + }; + underdouble = mkOption { + type = nullOr bool; + default = null; + description = "Underdouble attribute"; + }; + underdotted = mkOption { + type = nullOr bool; + default = null; + description = "Underdotted attribute"; + }; + underdashed = mkOption { + type = nullOr bool; + default = null; + description = "Underdashed attribute"; + }; + strikethrough = mkOption { + type = nullOr bool; + default = null; + description = "Strikethrough attribute"; + }; + italic = mkOption { + type = nullOr bool; + default = null; + description = "Bold attribute"; + }; + reverse = mkOption { + type = nullOr bool; + default = null; + description = "Reverse attribute"; + }; + nocombine = mkOption { + type = nullOr bool; + default = null; + description = "Nocombine attribute"; + }; + link = mkOption { + type = nullOr str; + default = null; + description = "Link attribute"; + }; + }; + }; +in { + options.vim.theme.custom = { + enable = mkEnableOption "Enable custom theme"; + name = mkOption { + type = str; + default = "my-custom-theme"; + description = "Name of custom theme"; + }; + highlights = mkOption { + type = attrsOf highlightOpts; + default = {}; + }; + }; +} diff --git a/outputs/pkgs/ook-vim/modules/plugins/theme/default.nix b/outputs/pkgs/ook-vim/modules/plugins/theme/default.nix new file mode 100644 index 0000000..bf217ec --- /dev/null +++ b/outputs/pkgs/ook-vim/modules/plugins/theme/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ./config.nix + ./custom-theme.nix + ]; +}