Improve kitty module (#42)

Directly use upstream template and add an option to use the 256 colors
variant.
This commit is contained in:
Luc Chabassier 2023-02-25 16:31:38 +01:00 committed by GitHub
parent 75ae5f52e2
commit ad560b2233
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,46 +1,26 @@
{ config, lib, ... }:
{ config, lib, pkgs, ... }:
{
options.stylix.targets.kitty.enable =
config.lib.stylix.mkEnableTarget "Kitty" true;
let
cfg = config.stylix.targets.kitty;
theme = config.lib.stylix.colors {
templateRepo = pkgs.fetchFromGitHub {
owner = "kdrag0n";
repo = "base16-kitty";
rev = "06bb401fa9a0ffb84365905ffbb959ae5bf40805";
sha256 = "sha256-aRaizTYPpuWEcvoYE9U+YRX+Wsc8+iG0guQJbvxEdJY=";
};
target = if cfg.variant256Colors then "default-256" else "default";
};
in {
options.stylix.targets.kitty = {
enable = config.lib.stylix.mkEnableTarget "Kitty" true;
variant256Colors = lib.mkOption { type = lib.types.bool; default = false; };
};
config = lib.mkIf config.stylix.targets.kitty.enable {
config = lib.mkIf cfg.enable {
programs.kitty = {
font = config.stylix.fonts.monospace;
settings = with config.lib.stylix.colors.withHashtag; {
# Based on https://github.com/kdrag0n/base16-kitty/
active_border_color = base03;
active_tab_background = base00;
active_tab_foreground = base05;
background = base00;
cursor = base05;
foreground = base05;
inactive_border_color = base01;
inactive_tab_background = base01;
inactive_tab_foreground = base04;
selection_background = base05;
selection_foreground = base00;
tab_bar_background = base01;
url_color = base04;
color0 = base00;
color1 = base08;
color2 = base0B;
color3 = base0A;
color4 = base0D;
color5 = base0E;
color6 = base0C;
color7 = base05;
color8 = base03;
color9 = base09;
color10 = base01;
color11 = base02;
color12 = base04;
color13 = base06;
color14 = base0F;
color15 = base07;
};
extraConfig = builtins.readFile theme;
};
};
}