more changes

This commit is contained in:
Charlie Root 2024-10-07 17:47:08 +02:00
parent 59b8335a26
commit c177916790
No known key found for this signature in database
2 changed files with 12 additions and 22 deletions

View file

@ -2,9 +2,10 @@
config,
lib,
}: let
inherit (lib.strings) optionalString;
inherit (lib.strings) hasPrefix optionalString;
inherit (lib.attrsets) listToAttrs;
inherit (lib.options) mkOption mkEnableOption;
inherit (lib.generators) mkLuaInline;
inherit (lib.types) bool str;
inherit (lib.nvim.types) hexColor mkPluginSetupOption;
cfg = config.vim.theme;
@ -17,7 +18,10 @@
value = mkOption {
description = "The base0${n} color to use";
type = hexColor;
default = cfg.base16-colors."base0${n}";
apply = v:
if hasPrefix "#" v
then v
else "#${v}";
};
})
numbers);
@ -37,7 +41,7 @@ in {
};
setup = ''
-- OneDark theme
require('onedark').load()
require('onedark').load()
'';
styles = ["dark" "darker" "cool" "deep" "warm" "warmer"];
};
@ -174,8 +178,8 @@ in {
default = "";
};
# TODO: fix these
# palette_overrides = mkOption{};
# overrides = {};
palette_overrides = mkLuaInline "{}";
overrides = mkLuaInline "{}";
dim_inactive = mkEnableOption "dim_inactive";
};
setup = ''

View file

@ -4,30 +4,16 @@
...
}: let
inherit (lib.options) mkOption;
inherit (lib.attrsets) attrNames listToAttrs;
inherit (lib.strings) elemAt hasPrefix;
inherit (lib.attrsets) attrNames;
inherit (lib.strings) elemAt;
inherit (lib.types) bool lines enum;
inherit (lib.modules) mkIf;
inherit (lib.nvim.dag) entryBefore;
inherit (lib.nvim.types) hexColor;
inherit (lib.nvim.lua) toLuaObject;
cfg = config.vim.theme;
supportedThemes = import ./supported-themes.nix {
inherit lib config;
};
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 {
options.vim.theme = {
enable = mkOption {
@ -42,8 +28,8 @@ in {
requires all of the colors in {option}`vim.theme.base16-colors` to be set.
'';
};
setupOpts = cfg.themes.${cfg.name}.setupOpts;
themes = supportedThemes;
base16-colors = base16Options;
style = mkOption {
type = enum supportedThemes.${cfg.name}.styles;