plugins/theme: apply requested changes

types/types.nix: remove unneeded inherit

theme/theme.nix: remove commented inherit
This commit is contained in:
Charlie Root 2024-10-05 13:02:22 +02:00
parent 5db7e2aff9
commit 49ec0adca3
No known key found for this signature in database
4 changed files with 20 additions and 77 deletions

View file

@ -1,6 +1,6 @@
{lib}: let
inherit (lib) isStringLike showOption showFiles getFiles mergeOneOption mergeEqualOption mkOptionType;
inherit (lib.strings) isString hasPrefix;
inherit (lib.strings) isString;
inherit (lib.types) anything attrsOf;
inherit (lib.nvim.types) anythingConcatLists;
inherit (builtins) typeOf isAttrs any head concatLists stringLength match;

View file

@ -1,69 +0,0 @@
{lib}: let
inherit (lib.options) mkOption;
inherit (lib.nvim.types) hexColorType;
in {
base00 = mkOption {
type = hexColorType;
default = "#1e1e2e";
};
base01 = mkOption {
type = hexColorType;
default = "#181825";
};
base02 = mkOption {
type = hexColorType;
default = "#313244";
};
base03 = mkOption {
type = hexColorType;
default = "#45475a";
};
base04 = mkOption {
type = hexColorType;
default = "#585b70";
};
base05 = mkOption {
type = hexColorType;
default = "#cdd6f4";
};
base06 = mkOption {
type = hexColorType;
default = "#f5e0dc";
};
base07 = mkOption {
type = hexColorType;
default = "#b4befe";
};
base08 = mkOption {
type = hexColorType;
default = "#f38ba8";
};
base09 = mkOption {
type = hexColorType;
default = "#fab387";
};
base0A = mkOption {
type = hexColorType;
default = "#a6e3a1";
};
base0B = mkOption {
type = hexColorType;
default = "#94e2d5";
};
base0C = mkOption {
type = hexColorType;
default = "#a6e3a1";
};
base0D = mkOption {
type = hexColorType;
default = "#89b4fa";
};
base0E = mkOption {
type = hexColorType;
default = "#cba6f4";
};
base0F = mkOption {
type = hexColorType;
default = "#f2cdcd";
};
}

View file

@ -5,12 +5,11 @@
inherit (lib.strings) optionalString;
inherit (lib.trivial) boolToString warnIf;
inherit (lib.nvim.lua) toLuaObject;
cfg = config.vim.theme;
in {
base16 = {
setup = {base16-colors, ...}: ''
-- Base-16 theme
require('base16-colorscheme').setup(${toLuaObject cfg.base16-colors})
-- Base16 theme
require('base16-colorscheme').setup(${toLuaObject base16-colors})
'';
};
onedark = {

View file

@ -3,30 +3,43 @@
lib,
...
}: let
inherit (builtins) listToAttrs;
inherit (lib.options) mkOption;
inherit (lib.attrsets) attrNames;
inherit (lib.strings) hasPrefix;
inherit (lib.types) bool lines enum;
inherit (lib.modules) mkIf;
inherit (lib.nvim.dag) entryBefore;
inherit (lib.nvim.types) hexColor;
cfg = config.vim.theme;
supportedThemes = import ./supported-themes.nix {
inherit lib config;
};
base16-colors = import ./base16-colors.nix {
inherit lib;
numbers = lib.stringToCharacters "0123456789ABCDEF";
generateBase16Options = listToAttrs (map (i: {
name = "base0${i}";
value = mkOption {
type = hexColor;
apply = v:
if hasPrefix "#" v
then v
else "#${v}";
};
})
numbers);
in {
options.vim.theme = {
enable = mkOption {
type = bool;
description = "Enable theming";
};
inherit base16-colors;
name = mkOption {
type = enum (attrNames supportedThemes);
description = "Supported themes can be found in `supportedThemes.nix`";
};
base16-colors = generateBase16Options;
style = mkOption {
type = enum supportedThemes.${cfg.name}.styles;