theme: switch to mapAttrs for setupOpts

This commit is contained in:
Charlie Root 2024-10-08 23:57:47 +02:00
parent 8f10028449
commit 7c01a7c875
No known key found for this signature in database
2 changed files with 70 additions and 67 deletions

View file

@ -3,9 +3,8 @@
lib, lib,
}: let }: let
inherit (lib.strings) hasPrefix optionalString; inherit (lib.strings) hasPrefix optionalString;
inherit (lib.attrsets) listToAttrs; inherit (lib.attrsets) genAttrs listToAttrs;
inherit (lib.options) mkOption mkEnableOption; inherit (lib.options) mkOption mkEnableOption;
inherit (lib.generators) mkLuaInline;
inherit (lib.types) bool str; inherit (lib.types) bool str;
inherit (lib.nvim.types) hexColor mkPluginSetupOption; inherit (lib.nvim.types) hexColor mkPluginSetupOption;
cfg = config.vim.theme; cfg = config.vim.theme;
@ -85,39 +84,41 @@ in {
internal = true; internal = true;
}; };
term_colors = mkEnableOption' "term_colors"; term_colors = mkEnableOption' "term_colors";
integrations = { integrations =
nvimtree = { {
enabled = mkEnableOption' "enabled"; nvimtree = {
transparent_panel = mkOption { enabled = mkEnableOption' "enabled";
type = bool; transparent_panel = mkOption {
default = cfg.transparent; type = bool;
default = cfg.transparent;
};
show_root = mkEnableOption' "show_root";
}; };
show_root = mkEnableOption' "show_root";
};
hop = mkEnableOption' "hop"; navic = {
gitsigns = mkEnableOption' "gitsigns"; enabled = mkEnableOption' "enabled";
telescope = mkEnableOption' "telescope"; # lualine will set backgound to mantle
treesitter = mkEnableOption' "treesitter"; custom_bg = mkOption {
treesitter_context = mkEnableOption' "treesitter_context"; type = str;
ts_rainbow = mkEnableOption' "ts_rainbow"; default = "NONE";
fidget = mkEnableOption' "fidget"; };
alpha = mkEnableOption' "alpha";
leap = mkEnableOption' "leap";
markdown = mkEnableOption' "markdown";
noice = mkEnableOption' "noice";
# nvim-notify
notify = mkEnableOption' "notify";
which_key = mkEnableOption' "which_key";
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);
}; };
setup = '' setup = ''
-- Catppuccin theme -- Catppuccin theme
@ -147,40 +148,43 @@ in {
}; };
gruvbox = { gruvbox = {
setupOpts = mkPluginSetupOption "gruvbox" { setupOpts =
transparent_mode = mkOption { mkPluginSetupOption "gruvbox" {
type = bool; transparent_mode = mkOption {
default = cfg.transparent; type = bool;
internal = true; default = cfg.transparent;
}; internal = true;
# transparent_mode = cfg.transparent; };
# add neovim terminal colors italic = {
terminal_colors = mkEnableOption' "terminal_colors"; strings = mkEnableOption' "strings";
undercurl = mkEnableOption' "undercurls"; emphasis = mkEnableOption' "emphasis";
underline = mkEnableOption' "underline"; comments = mkEnableOption' "comments";
bold = mkEnableOption' "bold"; operators = mkEnableOption "operators";
italic = { folds = mkEnableOption' "folds";
strings = mkEnableOption' "strings"; };
emphasis = mkEnableOption' "emphasis"; contrast = mkOption {
comments = mkEnableOption' "comments"; type = str;
operators = mkEnableOption "operators"; default = "";
folds = mkEnableOption' "folds"; };
}; # TODO: fix these
strikethrough = mkEnableOption' "strikethrough"; # palette_overrides = mkLuaInline "{}";
invert_selection = mkEnableOption "invert_selection"; # overrides = mkLuaInline "{}";
invert_signs = mkEnableOption "invert_signs"; }
invert_tabline = mkEnableOption "invert_tabline"; // genAttrs [
invert_intend_guides = mkEnableOption "invert_intend_guides"; "terminal_colors"
inverse = mkEnableOption' "inverse"; "undercurls"
contrast = mkOption { "underline"
type = str; "bold"
default = ""; "strikethrough"
}; "inverse"
# TODO: fix these ] (name: mkEnableOption' name)
# palette_overrides = mkLuaInline "{}"; // genAttrs [
# overrides = mkLuaInline "{}"; "invert_selection"
dim_inactive = mkEnableOption "dim_inactive"; "invert_signs"
}; "invert_tabline"
"invert_intend_guides"
"dim_inactive"
] (name: mkEnableOption name);
setup = '' setup = ''
-- Gruvbox theme -- Gruvbox theme
vim.o.background = "${cfg.style}" vim.o.background = "${cfg.style}"

View file

@ -17,7 +17,6 @@
}; };
in { in {
options.vim.theme = { options.vim.theme = {
themes = supportedThemes;
inherit (supportedThemes.${cfg.name}) setupOpts; inherit (supportedThemes.${cfg.name}) setupOpts;
enable = mkOption { enable = mkOption {