2023-12-31 12:22:55 +01:00
|
|
|
{
|
2024-09-14 11:26:36 -05:00
|
|
|
config,
|
2023-12-31 12:22:55 +01:00
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}:
|
2024-08-22 09:24:17 -05:00
|
|
|
let
|
|
|
|
inherit (lib.nixvim) defaultNullOpts;
|
|
|
|
in
|
2024-12-22 09:58:27 +00:00
|
|
|
lib.nixvim.plugins.mkNeovimPlugin {
|
2024-04-07 18:18:49 +02:00
|
|
|
name = "palette";
|
|
|
|
isColorscheme = true;
|
2024-12-13 08:27:14 -06:00
|
|
|
packPathName = "palette.nvim";
|
2024-09-02 14:05:11 +01:00
|
|
|
package = "palette-nvim";
|
2024-05-05 19:39:35 +02:00
|
|
|
|
2024-08-22 10:03:02 -05:00
|
|
|
maintainers = [ lib.maintainers.GaetanLepage ];
|
2024-05-05 19:39:35 +02:00
|
|
|
|
2024-04-07 18:18:49 +02:00
|
|
|
extraPlugins = [
|
|
|
|
# Annoyingly, lspconfig is required, otherwise this line is breaking:
|
|
|
|
# https://github.com/roobert/palette.nvim/blob/a808c190a4f74f73782302152ebf323660d8db5f/lua/palette/init.lua#L45
|
|
|
|
# An issue has been opened upstream to warn the maintainer: https://github.com/roobert/palette.nvim/issues/2
|
2024-09-14 11:26:36 -05:00
|
|
|
config.plugins.lsp.package
|
2024-04-07 18:18:49 +02:00
|
|
|
];
|
2024-05-05 19:39:35 +02:00
|
|
|
|
2024-04-07 18:18:49 +02:00
|
|
|
# TODO introduced 2024-04-07: remove 2024-06-07
|
|
|
|
deprecateExtraOptions = true;
|
|
|
|
optionsRenamedToSettings = [
|
|
|
|
"palettes"
|
|
|
|
"customPalettes"
|
|
|
|
"italics"
|
|
|
|
"transparentBackground"
|
|
|
|
"caching"
|
|
|
|
"cacheDir"
|
|
|
|
];
|
2024-05-05 19:39:35 +02:00
|
|
|
|
2024-04-07 18:18:49 +02:00
|
|
|
settingsOptions = {
|
2023-12-31 12:22:55 +01:00
|
|
|
palettes = {
|
2024-08-22 09:24:17 -05:00
|
|
|
main = defaultNullOpts.mkStr "dark" ''
|
2023-12-31 12:22:55 +01:00
|
|
|
Palette for the main colors.
|
|
|
|
'';
|
2024-05-05 19:39:35 +02:00
|
|
|
|
2024-08-22 09:24:17 -05:00
|
|
|
accent = defaultNullOpts.mkStr "pastel" ''
|
2023-12-31 12:22:55 +01:00
|
|
|
Palette for the accent colors.
|
|
|
|
'';
|
2024-05-05 19:39:35 +02:00
|
|
|
|
2024-08-22 09:24:17 -05:00
|
|
|
state = defaultNullOpts.mkStr "pastel" ''
|
2023-12-31 12:22:55 +01:00
|
|
|
Palette for the state colors.
|
|
|
|
'';
|
|
|
|
};
|
2024-05-05 19:39:35 +02:00
|
|
|
|
2024-12-17 15:47:56 +01:00
|
|
|
custom_palettes =
|
2024-08-22 10:03:02 -05:00
|
|
|
lib.mapAttrs
|
2023-12-31 12:22:55 +01:00
|
|
|
(
|
|
|
|
name: colorNames:
|
2024-08-22 09:24:17 -05:00
|
|
|
defaultNullOpts.mkAttrsOf
|
2024-08-22 10:03:02 -05:00
|
|
|
(lib.types.submodule {
|
|
|
|
options = lib.genAttrs colorNames (
|
2023-12-31 12:22:55 +01:00
|
|
|
colorName:
|
2024-08-22 10:03:02 -05:00
|
|
|
lib.mkOption {
|
|
|
|
type = lib.types.str;
|
2023-12-31 12:22:55 +01:00
|
|
|
description = "Definition of color '${colorName}'";
|
|
|
|
}
|
|
|
|
);
|
|
|
|
})
|
2024-06-11 16:50:59 +01:00
|
|
|
{ }
|
2023-12-31 12:22:55 +01:00
|
|
|
''
|
|
|
|
Custom palettes for ${name} colors.
|
|
|
|
''
|
|
|
|
)
|
|
|
|
{
|
|
|
|
main = [
|
|
|
|
"color0"
|
|
|
|
"color1"
|
|
|
|
"color2"
|
|
|
|
"color3"
|
|
|
|
"color4"
|
|
|
|
"color5"
|
|
|
|
"color6"
|
|
|
|
"color7"
|
|
|
|
"color8"
|
|
|
|
];
|
|
|
|
|
|
|
|
accent = [
|
|
|
|
"accent0"
|
|
|
|
"accent1"
|
|
|
|
"accent2"
|
|
|
|
"accent3"
|
|
|
|
"accent4"
|
|
|
|
"accent5"
|
|
|
|
"accent6"
|
|
|
|
];
|
|
|
|
|
|
|
|
state = [
|
|
|
|
"error"
|
|
|
|
"warning"
|
|
|
|
"hint"
|
|
|
|
"ok"
|
|
|
|
"info"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2024-08-22 09:24:17 -05:00
|
|
|
italics = defaultNullOpts.mkBool true ''
|
2023-12-31 12:22:55 +01:00
|
|
|
Whether to use italics.
|
|
|
|
'';
|
|
|
|
|
2024-08-22 09:24:17 -05:00
|
|
|
transparent_background = defaultNullOpts.mkBool false ''
|
2023-12-31 12:22:55 +01:00
|
|
|
Whether to use transparent background.
|
|
|
|
'';
|
|
|
|
|
2024-08-22 09:24:17 -05:00
|
|
|
caching = defaultNullOpts.mkBool true ''
|
2023-12-31 12:22:55 +01:00
|
|
|
Whether to enable caching.
|
|
|
|
'';
|
|
|
|
|
2024-08-22 09:24:17 -05:00
|
|
|
cache_dir = defaultNullOpts.mkStr {
|
2024-06-11 16:50:59 +01:00
|
|
|
__raw = "vim.fn.stdpath('cache') .. '/palette'";
|
|
|
|
} "Cache directory.";
|
2023-12-31 12:22:55 +01:00
|
|
|
};
|
|
|
|
|
2024-04-07 18:18:49 +02:00
|
|
|
settingsExample = { };
|
|
|
|
|
|
|
|
extraConfig = cfg: {
|
2025-01-20 14:23:55 +01:00
|
|
|
assertions = lib.nixvim.mkAssertions "colorschemes.palette" (
|
2024-08-22 10:03:02 -05:00
|
|
|
lib.mapAttrsToList
|
2024-04-07 18:18:49 +02:00
|
|
|
(
|
|
|
|
name: defaultPaletteNames:
|
|
|
|
let
|
2024-08-22 10:03:02 -05:00
|
|
|
customPalettesNames = lib.attrNames cfg.settings.custom_palettes.${name};
|
2024-04-07 18:18:49 +02:00
|
|
|
allowedPaletteNames = customPalettesNames ++ defaultPaletteNames;
|
|
|
|
|
|
|
|
palette = cfg.settings.palettes.${name};
|
|
|
|
in
|
|
|
|
{
|
2024-08-22 10:03:02 -05:00
|
|
|
assertion = lib.isString palette -> lib.elem palette allowedPaletteNames;
|
2024-04-07 18:18:49 +02:00
|
|
|
message = ''
|
2025-01-20 14:23:55 +01:00
|
|
|
`settings.palettes.${name}` (${palette}") is not part of the allowed ${name} palette names (${lib.concatStringsSep " " allowedPaletteNames}).
|
2024-04-07 18:18:49 +02:00
|
|
|
'';
|
|
|
|
}
|
|
|
|
)
|
2023-12-31 12:22:55 +01:00
|
|
|
{
|
2024-04-07 18:18:49 +02:00
|
|
|
main = [
|
|
|
|
"dark"
|
|
|
|
"light"
|
|
|
|
];
|
|
|
|
accent = [
|
|
|
|
"pastel"
|
|
|
|
"dark"
|
|
|
|
"bright"
|
|
|
|
];
|
|
|
|
state = [
|
|
|
|
"pastel"
|
|
|
|
"dark"
|
|
|
|
"bright"
|
|
|
|
];
|
2025-01-20 14:23:55 +01:00
|
|
|
}
|
|
|
|
);
|
2024-04-07 18:18:49 +02:00
|
|
|
};
|
|
|
|
}
|