2023-02-20 11:42:13 +01:00
|
|
|
{
|
|
|
|
pkgs,
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
} @ args:
|
2023-02-01 17:17:27 +01:00
|
|
|
with lib; let
|
2022-09-18 11:19:23 +01:00
|
|
|
cfg = config.colorschemes.tokyonight;
|
2023-02-01 17:17:27 +01:00
|
|
|
helpers = import ../helpers.nix args;
|
2023-02-20 11:42:13 +01:00
|
|
|
in {
|
2021-11-02 12:00:14 +01:00
|
|
|
options = {
|
2022-09-18 11:19:23 +01:00
|
|
|
colorschemes.tokyonight = {
|
2023-01-22 03:32:08 +00:00
|
|
|
enable = mkEnableOption "tokyonight";
|
2023-01-25 19:46:49 +01:00
|
|
|
package = helpers.mkPackageOption "tokyonight" pkgs.vimPlugins.tokyonight-nvim;
|
2023-02-20 11:42:13 +01:00
|
|
|
style = helpers.defaultNullOpts.mkEnumFirstDefault ["storm" "night" "day"] "Theme style";
|
2023-02-01 17:17:27 +01:00
|
|
|
terminalColors =
|
|
|
|
helpers.defaultNullOpts.mkBool true
|
2023-02-20 11:42:13 +01:00
|
|
|
"Configure the colors used when opening a :terminal in Neovim";
|
2023-02-01 17:17:27 +01:00
|
|
|
transparent = helpers.defaultNullOpts.mkBool false "disable setting the background color";
|
2023-02-20 11:42:13 +01:00
|
|
|
styles = let
|
|
|
|
mkBackgroundStyle = name:
|
|
|
|
helpers.defaultNullOpts.mkEnumFirstDefault ["dark" "transparent" "normal"]
|
|
|
|
"Background style for ${name}";
|
|
|
|
in {
|
|
|
|
comments =
|
|
|
|
helpers.defaultNullOpts.mkNullable (types.attrsOf types.anything) "{italic = true;}"
|
|
|
|
"Define comments highlight properties";
|
|
|
|
keywords =
|
|
|
|
helpers.defaultNullOpts.mkNullable (types.attrsOf types.anything) "{italic = true;}"
|
|
|
|
"Define keywords highlight properties";
|
|
|
|
functions =
|
|
|
|
helpers.defaultNullOpts.mkNullable (types.attrsOf types.anything) "{}"
|
|
|
|
"Define functions highlight properties";
|
|
|
|
variables =
|
|
|
|
helpers.defaultNullOpts.mkNullable (types.attrsOf types.anything) "{}"
|
|
|
|
"Define variables highlight properties";
|
|
|
|
sidebars = mkBackgroundStyle "sidebars";
|
|
|
|
floats = mkBackgroundStyle "floats";
|
|
|
|
};
|
2023-02-01 17:17:27 +01:00
|
|
|
sidebars =
|
|
|
|
helpers.defaultNullOpts.mkNullable (types.listOf types.str) ''["qf" "help"]''
|
2023-02-20 11:42:13 +01:00
|
|
|
"Set a darker background on sidebar-like windows";
|
2023-02-01 17:17:27 +01:00
|
|
|
dayBrightness =
|
|
|
|
helpers.defaultNullOpts.mkNullable (types.numbers.between 0.0 1.0) "0.3"
|
2023-02-20 11:42:13 +01:00
|
|
|
"Adjusts the brightness of the colors of the **Day** style";
|
2022-12-24 01:08:54 +01:00
|
|
|
hideInactiveStatusline =
|
2023-02-01 17:17:27 +01:00
|
|
|
helpers.defaultNullOpts.mkBool false
|
2023-02-20 11:42:13 +01:00
|
|
|
"Enabling this option will hide inactive statuslines and replace them with a thin border";
|
2023-02-01 17:17:27 +01:00
|
|
|
dimInactive = helpers.defaultNullOpts.mkBool false "dims inactive windows";
|
2022-12-24 01:08:54 +01:00
|
|
|
lualineBold =
|
2023-02-01 17:17:27 +01:00
|
|
|
helpers.defaultNullOpts.mkBool false
|
2023-02-20 11:42:13 +01:00
|
|
|
"When true, section headers in the lualine theme will be bold";
|
2023-03-31 23:12:48 +02:00
|
|
|
onColors =
|
|
|
|
helpers.defaultNullOpts.mkStr "function(colors) end"
|
|
|
|
''
|
|
|
|
Override specific color groups to use other groups or a hex color.
|
|
|
|
function will be called with a ColorScheme table.
|
|
|
|
`@param colors ColorScheme`
|
|
|
|
'';
|
|
|
|
onHighlights =
|
|
|
|
helpers.defaultNullOpts.mkStr "function(highlights, colors) end"
|
|
|
|
''
|
|
|
|
Override specific highlights to use other groups or a hex color.
|
|
|
|
function will be called with a Highlights and ColorScheme table
|
|
|
|
`@param highlights Highlights`
|
|
|
|
`@param colors ColorScheme`
|
|
|
|
'';
|
2021-11-02 12:00:14 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
2022-09-18 11:19:23 +01:00
|
|
|
colorscheme = "tokyonight";
|
2023-02-20 11:42:13 +01:00
|
|
|
extraPlugins = [cfg.package];
|
|
|
|
options = {termguicolors = true;};
|
|
|
|
extraConfigLuaPre = let
|
|
|
|
setupOptions = with cfg; {
|
|
|
|
inherit (cfg) style transparent styles sidebars;
|
|
|
|
terminal_colors = terminalColors;
|
|
|
|
hide_inactive_statusline = hideInactiveStatusline;
|
|
|
|
dim_inactive = dimInactive;
|
|
|
|
lualine_bold = lualineBold;
|
|
|
|
day_brightness = dayBrightness;
|
2023-03-31 23:12:48 +02:00
|
|
|
on_colors =
|
|
|
|
helpers.ifNonNull' cfg.onColors
|
|
|
|
(helpers.mkRaw onColors);
|
|
|
|
on_highlights =
|
|
|
|
helpers.ifNonNull' cfg.onHighlights
|
|
|
|
(helpers.mkRaw onHighlights);
|
2023-02-20 11:42:13 +01:00
|
|
|
};
|
|
|
|
in ''
|
|
|
|
require("tokyonight").setup(${helpers.toLuaObject setupOptions})
|
|
|
|
'';
|
2021-11-02 12:00:14 +01:00
|
|
|
};
|
|
|
|
}
|