mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-26 15:06:45 +00:00
more progress
This commit is contained in:
parent
b66ee19ff3
commit
59b8335a26
2 changed files with 46 additions and 25 deletions
|
@ -3,24 +3,35 @@
|
||||||
lib,
|
lib,
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.strings) optionalString;
|
inherit (lib.strings) optionalString;
|
||||||
|
inherit (lib.attrsets) listToAttrs;
|
||||||
inherit (lib.options) mkOption mkEnableOption;
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
inherit (lib.types) bool str;
|
inherit (lib.types) bool str;
|
||||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
inherit (lib.nvim.types) hexColor mkPluginSetupOption;
|
||||||
cfg = config.vim.theme;
|
cfg = config.vim.theme;
|
||||||
|
|
||||||
mkEnableOption' = name: mkEnableOption name // {default = true;};
|
mkEnableOption' = name: mkEnableOption name // {default = true;};
|
||||||
# mkEnableOption' = name: mkEnableOption name;
|
|
||||||
|
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;
|
||||||
|
default = cfg.base16-colors."base0${n}";
|
||||||
|
};
|
||||||
|
})
|
||||||
|
numbers);
|
||||||
in {
|
in {
|
||||||
base16 = {
|
base16 = {
|
||||||
setupOpts = mkPluginSetupOption "base16" {
|
setupOpts = mkPluginSetupOption "base16" base16Options;
|
||||||
inherit (cfg) base16-colors;
|
setup = "";
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
onedark = {
|
onedark = {
|
||||||
setupOpts = mkPluginSetupOption "onedark" {
|
setupOpts = mkPluginSetupOption "onedark" {
|
||||||
style = mkOption {
|
style = mkOption {
|
||||||
type = str;
|
type = str;
|
||||||
default = "dark";
|
default = cfg.style;
|
||||||
internal = true;
|
internal = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -40,9 +51,9 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
setup = ''
|
setup = ''
|
||||||
vim.cmd[[colorscheme tokyonight-${cfg.style ? "night"}]]
|
vim.cmd[[colorscheme tokyonight-${cfg.style}]]
|
||||||
'';
|
'';
|
||||||
styles = ["day" "night" "storm" "moon"];
|
styles = ["night" "day" "storm" "moon"];
|
||||||
};
|
};
|
||||||
|
|
||||||
dracula = {
|
dracula = {
|
||||||
|
@ -60,15 +71,14 @@ in {
|
||||||
|
|
||||||
catppuccin = {
|
catppuccin = {
|
||||||
setupOpts = mkPluginSetupOption "catppuccin" {
|
setupOpts = mkPluginSetupOption "catppuccin" {
|
||||||
# flavour = cfg.style ? "mocha";
|
|
||||||
flavour = mkOption {
|
flavour = mkOption {
|
||||||
type = str;
|
type = str;
|
||||||
default = cfg.style ? "mocha";
|
default = cfg.style;
|
||||||
internal = true;
|
# internal = true;
|
||||||
};
|
};
|
||||||
transparent_background = mkOption {
|
transparent_background = mkOption {
|
||||||
type = bool;
|
type = bool;
|
||||||
default = cfg.transparency;
|
default = cfg.transparent;
|
||||||
internal = true;
|
internal = true;
|
||||||
};
|
};
|
||||||
term_colors = mkEnableOption' "term_colors";
|
term_colors = mkEnableOption' "term_colors";
|
||||||
|
@ -77,7 +87,7 @@ in {
|
||||||
enabled = mkEnableOption' "enabled";
|
enabled = mkEnableOption' "enabled";
|
||||||
transparent_panel = mkOption {
|
transparent_panel = mkOption {
|
||||||
type = bool;
|
type = bool;
|
||||||
default = cfg.transparency;
|
default = cfg.transparent;
|
||||||
};
|
};
|
||||||
show_root = mkEnableOption' "show_root";
|
show_root = mkEnableOption' "show_root";
|
||||||
};
|
};
|
||||||
|
@ -96,7 +106,7 @@ in {
|
||||||
# nvim-notify
|
# nvim-notify
|
||||||
notify = mkEnableOption' "notify";
|
notify = mkEnableOption' "notify";
|
||||||
which_key = mkEnableOption' "which_key";
|
which_key = mkEnableOption' "which_key";
|
||||||
navic = mkOption {
|
navic = {
|
||||||
enabled = mkEnableOption' "enabled";
|
enabled = mkEnableOption' "enabled";
|
||||||
# lualine will set backgound to mantle
|
# lualine will set backgound to mantle
|
||||||
custom_bg = mkOption {
|
custom_bg = mkOption {
|
||||||
|
@ -106,19 +116,19 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
setup = _: ''
|
setup = ''
|
||||||
-- Catppuccin theme
|
-- Catppuccin theme
|
||||||
-- setup must be called before loading
|
-- setup must be called before loading
|
||||||
vim.cmd.colorscheme "catppuccin"
|
vim.cmd.colorscheme "catppuccin"
|
||||||
'';
|
'';
|
||||||
styles = ["latte" "frappe" "macchiato" "mocha"];
|
styles = ["mocha" "latte" "frappe" "macchiato"];
|
||||||
};
|
};
|
||||||
|
|
||||||
oxocarbon = {
|
oxocarbon = {
|
||||||
setupOpts = mkPluginSetupOption "oxocarbon" {};
|
setupOpts = mkPluginSetupOption "oxocarbon" {};
|
||||||
setup = ''
|
setup = ''
|
||||||
require('oxocarbon')
|
require('oxocarbon')
|
||||||
vim.opt.background = "${cfg.style ? "dark"}"
|
vim.opt.background = "${cfg.style}"
|
||||||
vim.cmd.colorscheme = "oxocarbon"
|
vim.cmd.colorscheme = "oxocarbon"
|
||||||
${optionalString cfg.transparent ''
|
${optionalString cfg.transparent ''
|
||||||
vim.api.nvim_set_hl(0, "Normal", { bg = "none" })
|
vim.api.nvim_set_hl(0, "Normal", { bg = "none" })
|
||||||
|
@ -135,7 +145,12 @@ in {
|
||||||
|
|
||||||
gruvbox = {
|
gruvbox = {
|
||||||
setupOpts = mkPluginSetupOption "gruvbox" {
|
setupOpts = mkPluginSetupOption "gruvbox" {
|
||||||
transparent_mode = cfg.transparent;
|
transparent_mode = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = cfg.transparent;
|
||||||
|
internal = true;
|
||||||
|
};
|
||||||
|
# transparent_mode = cfg.transparent;
|
||||||
# add neovim terminal colors
|
# add neovim terminal colors
|
||||||
terminal_colors = mkEnableOption' "terminal_colors";
|
terminal_colors = mkEnableOption' "terminal_colors";
|
||||||
undercurl = mkEnableOption' "undercurls";
|
undercurl = mkEnableOption' "undercurls";
|
||||||
|
@ -154,14 +169,18 @@ in {
|
||||||
invert_tabline = mkEnableOption "invert_tabline";
|
invert_tabline = mkEnableOption "invert_tabline";
|
||||||
invert_intend_guides = mkEnableOption "invert_intend_guides";
|
invert_intend_guides = mkEnableOption "invert_intend_guides";
|
||||||
inverse = mkEnableOption' "inverse";
|
inverse = mkEnableOption' "inverse";
|
||||||
contrast = "";
|
contrast = mkOption {
|
||||||
palette_overrides = {};
|
type = str;
|
||||||
overrides = {};
|
default = "";
|
||||||
|
};
|
||||||
|
# TODO: fix these
|
||||||
|
# palette_overrides = mkOption{};
|
||||||
|
# overrides = {};
|
||||||
dim_inactive = mkEnableOption "dim_inactive";
|
dim_inactive = mkEnableOption "dim_inactive";
|
||||||
};
|
};
|
||||||
setup = ''
|
setup = ''
|
||||||
-- Gruvbox theme
|
-- Gruvbox theme
|
||||||
vim.o.background = "${cfg.style ? "dark"}"
|
vim.o.background = "${cfg.style}"
|
||||||
vim.cmd("colorscheme gruvbox")
|
vim.cmd("colorscheme gruvbox")
|
||||||
'';
|
'';
|
||||||
styles = ["dark" "light"];
|
styles = ["dark" "light"];
|
||||||
|
@ -170,7 +189,7 @@ in {
|
||||||
setupOpts = mkPluginSetupOption "rose-pine" {
|
setupOpts = mkPluginSetupOption "rose-pine" {
|
||||||
dark_variant = mkOption {
|
dark_variant = mkOption {
|
||||||
type = str;
|
type = str;
|
||||||
style = cfg.style ? "main";
|
default = cfg.style;
|
||||||
internal = true;
|
internal = true;
|
||||||
};
|
};
|
||||||
dim_inactive_windows = mkEnableOption "dim_inactive_windows";
|
dim_inactive_windows = mkEnableOption "dim_inactive_windows";
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.options) mkOption;
|
inherit (lib.options) mkOption;
|
||||||
inherit (lib.attrsets) attrNames listToAttrs;
|
inherit (lib.attrsets) attrNames listToAttrs;
|
||||||
inherit (lib.strings) hasPrefix;
|
inherit (lib.strings) elemAt hasPrefix;
|
||||||
inherit (lib.types) bool lines enum;
|
inherit (lib.types) bool lines enum;
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.nvim.dag) entryBefore;
|
inherit (lib.nvim.dag) entryBefore;
|
||||||
|
@ -42,10 +42,12 @@ in {
|
||||||
requires all of the colors in {option}`vim.theme.base16-colors` to be set.
|
requires all of the colors in {option}`vim.theme.base16-colors` to be set.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
themes = supportedThemes;
|
||||||
base16-colors = base16Options;
|
base16-colors = base16Options;
|
||||||
|
|
||||||
style = mkOption {
|
style = mkOption {
|
||||||
type = enum supportedThemes.${cfg.name}.styles;
|
type = enum supportedThemes.${cfg.name}.styles;
|
||||||
|
default = elemAt supportedThemes.${cfg.name}.styles 0;
|
||||||
description = "Specific style for theme if it supports it";
|
description = "Specific style for theme if it supports it";
|
||||||
};
|
};
|
||||||
transparent = mkOption {
|
transparent = mkOption {
|
||||||
|
@ -71,7 +73,7 @@ in {
|
||||||
luaConfigRC.theme = entryBefore ["pluginConfigs"] ''
|
luaConfigRC.theme = entryBefore ["pluginConfigs"] ''
|
||||||
${cfg.extraConfig}
|
${cfg.extraConfig}
|
||||||
|
|
||||||
require(${name'}).setup(${toLuaObject supportedThemes.${cfg.name}.setupOpts})
|
require('${name'}').setup(${toLuaObject cfg.themes.${cfg.name}.setupOpts})
|
||||||
|
|
||||||
${supportedThemes.${cfg.name}.setup}
|
${supportedThemes.${cfg.name}.setup}
|
||||||
'';
|
'';
|
||||||
|
|
Loading…
Reference in a new issue