Compare commits

..

3 commits

Author SHA1 Message Date
Charlie Root
67fb3e00a4
theme/supported-themes.nix: use mergeAttrsList to generate options 2024-10-09 00:17:23 +02:00
Charlie Root
e9f9353c45
more mapAttrs
because diniamo loves it so much
2024-10-09 00:08:30 +02:00
Charlie Root
7c01a7c875
theme: switch to mapAttrs for setupOpts 2024-10-08 23:57:47 +02:00
2 changed files with 76 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 mergeAttrsList;
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,49 @@ 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"; {
undercurl = mkEnableOption' "undercurls"; operators = mkEnableOption "operators";
underline = mkEnableOption' "underline"; }
bold = mkEnableOption' "bold"; // genAttrs [
italic = { "strings"
strings = mkEnableOption' "strings"; "emphasis"
emphasis = mkEnableOption' "emphasis"; "comments"
comments = mkEnableOption' "comments"; "folds"
operators = mkEnableOption "operators"; ] (name: mkEnableOption' name);
folds = mkEnableOption' "folds";
}; contrast = mkOption {
strikethrough = mkEnableOption' "strikethrough"; type = str;
invert_selection = mkEnableOption "invert_selection"; default = "";
invert_signs = mkEnableOption "invert_signs"; };
invert_tabline = mkEnableOption "invert_tabline"; # TODO: fix these
invert_intend_guides = mkEnableOption "invert_intend_guides"; # palette_overrides = mkLuaInline "{}";
inverse = mkEnableOption' "inverse"; # overrides = mkLuaInline "{}";
contrast = mkOption { }
type = str; // mergeAttrsList [
default = ""; (genAttrs [
}; "terminal_colors"
# TODO: fix these "undercurls"
# palette_overrides = mkLuaInline "{}"; "underline"
# overrides = mkLuaInline "{}"; "bold"
dim_inactive = mkEnableOption "dim_inactive"; "strikethrough"
}; "inverse"
] (name: mkEnableOption' name))
(genAttrs [
"invert_selection"
"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 {