From 013a6ddd9fd999b1dfa48ed9e290c69fac03a143 Mon Sep 17 00:00:00 2001 From: Charlie Root Date: Sun, 10 Nov 2024 18:35:18 +0100 Subject: [PATCH] progress --- .../plugins/theme/supported-themes/base16.nix | 43 ++++++++++ .../theme/supported-themes/catppuccin.nix | 78 +++++++++++++++++++ .../theme/supported-themes/default.nix | 0 .../theme/supported-themes/dracula.nix | 0 .../theme/supported-themes/gruvbox.nix | 0 .../theme/supported-themes/onedark.nix | 0 .../theme/supported-themes/oxocarbon.nix | 0 .../theme/supported-themes/rose-pine.nix | 0 8 files changed, 121 insertions(+) create mode 100644 modules/plugins/theme/supported-themes/base16.nix create mode 100644 modules/plugins/theme/supported-themes/catppuccin.nix create mode 100644 modules/plugins/theme/supported-themes/default.nix create mode 100644 modules/plugins/theme/supported-themes/dracula.nix create mode 100644 modules/plugins/theme/supported-themes/gruvbox.nix create mode 100644 modules/plugins/theme/supported-themes/onedark.nix create mode 100644 modules/plugins/theme/supported-themes/oxocarbon.nix create mode 100644 modules/plugins/theme/supported-themes/rose-pine.nix diff --git a/modules/plugins/theme/supported-themes/base16.nix b/modules/plugins/theme/supported-themes/base16.nix new file mode 100644 index 0000000..004034b --- /dev/null +++ b/modules/plugins/theme/supported-themes/base16.nix @@ -0,0 +1,43 @@ +{ + config, + lib, + ... +}: let + cfg = config.vim.theme; + inherit (lib.strings) hasPrefix; + inherit (lib.attrsets) listToAttrs; + inherit (lib.options) mkOption; + inherit (lib.modules) mkIf; + inherit (lib.nvim.types) hexColor mkPluginSetupOption; + inherit (lib.nvim.dag) entryBefore; + inherit (lib.nvim.lua) toLuaObject; + + numbers = ["0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "A" "B" "C" "D" "E" "F"]; + base16Options = listToAttrs (map (n: { + name = "base0${n}"; + value = mkOption { + description = "The base0${n} color to use"; + type = hexColor; + apply = v: + if hasPrefix "#" v + then v + else "#${v}"; + }; + }) + numbers); +in { + base16 = { + setupOpts = mkPluginSetupOption "base16" base16Options; + setup = ""; + }; + config = + mkIf cfg.name + == "base16" { + vim = { + startPlugins = ["base16"]; + luaConfigRC.theme = entryBefore ["pluginConfigs"] '' + require('base16-colorscheme').setup(${toLuaObject cfg.setupOpts}) + ''; + }; + }; +} diff --git a/modules/plugins/theme/supported-themes/catppuccin.nix b/modules/plugins/theme/supported-themes/catppuccin.nix new file mode 100644 index 0000000..fc26b69 --- /dev/null +++ b/modules/plugins/theme/supported-themes/catppuccin.nix @@ -0,0 +1,78 @@ +{ + config, + lib, + ... +}: let + cfg = config.vim.theme; + inherit (lib.strings) hasPrefix optionalString; + inherit (lib.attrsets) genAttrs listToAttrs mergeAttrsList; + inherit (lib.options) mkOption mkEnableOption; + inherit (lib.types) bool str; + inherit (lib.modules) mkIf; + inherit (lib.nvim.types) hexColor mkPluginSetupOption; + inherit (lib.nvim.dag) entryBefore; + inherit (lib.nvim.lua) toLuaObject; + mkEnableOption' = name: mkEnableOption name // {default = true;}; +in { + catppuccin = { + setupOpts = mkPluginSetupOption "catppuccin" { + flavour = mkOption { + type = str; + default = cfg.style; + # internal = true; + }; + transparent_background = mkOption { + type = bool; + default = cfg.transparent; + internal = true; + }; + term_colors = mkEnableOption' "term_colors"; + integrations = + { + nvimtree = { + enabled = mkEnableOption' "enabled"; + transparent_panel = mkOption { + type = bool; + default = cfg.transparent; + }; + show_root = mkEnableOption' "show_root"; + }; + + navic = { + enabled = mkEnableOption' "enabled"; + # lualine will set backgound to mantle + custom_bg = mkOption { + type = str; + default = "NONE"; + }; + }; + } + // genAttrs [ + "hop" + "gitsigns" + "telescope" + "treesitter" + "treesitter_context" + "ts_rainbow" + "fidget" + "alpha" + "leap" + "markdown" + "noice" + "notify" + "which_key" + ] (name: mkEnableOption' name); + }; + }; + config = + mkIf cfg.name + == "catppuccin" { + vim = { + startPlugins = ["catppuccin"]; + luaConfigRC.theme = entryBefore ["pluginConfigs"] '' + then "require('catppuccin').setup(${toLuaObject cfg.setupOpts})" + } + ''; + }; + }; +} diff --git a/modules/plugins/theme/supported-themes/default.nix b/modules/plugins/theme/supported-themes/default.nix new file mode 100644 index 0000000..e69de29 diff --git a/modules/plugins/theme/supported-themes/dracula.nix b/modules/plugins/theme/supported-themes/dracula.nix new file mode 100644 index 0000000..e69de29 diff --git a/modules/plugins/theme/supported-themes/gruvbox.nix b/modules/plugins/theme/supported-themes/gruvbox.nix new file mode 100644 index 0000000..e69de29 diff --git a/modules/plugins/theme/supported-themes/onedark.nix b/modules/plugins/theme/supported-themes/onedark.nix new file mode 100644 index 0000000..e69de29 diff --git a/modules/plugins/theme/supported-themes/oxocarbon.nix b/modules/plugins/theme/supported-themes/oxocarbon.nix new file mode 100644 index 0000000..e69de29 diff --git a/modules/plugins/theme/supported-themes/rose-pine.nix b/modules/plugins/theme/supported-themes/rose-pine.nix new file mode 100644 index 0000000..e69de29