This commit is contained in:
Charlie Root 2024-11-10 18:35:18 +01:00
parent 67fb3e00a4
commit 013a6ddd9f
No known key found for this signature in database
8 changed files with 121 additions and 0 deletions

View file

@ -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})
'';
};
};
}

View file

@ -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})"
}
'';
};
};
}