From 040515003fa03ea7e46bbe6ba8815779d45b24fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thea=20Sch=C3=B6bl?= Date: Sun, 7 Apr 2024 17:05:31 +0200 Subject: [PATCH] feat: flavours colorscheme --- hosts/MONSTER/home.nix | 5 ++- modules/home-manager/default.nix | 6 +-- .../home-manager/desktops/hyprland/kitty.nix | 2 - modules/home-manager/theme/default.nix | 37 +++++++++++++++++++ .../theme/integrations/kitty/default.mustache | 35 ++++++++++++++++++ .../theme/integrations/kitty/default.nix | 25 +++++++++++++ 6 files changed, 104 insertions(+), 6 deletions(-) create mode 100644 modules/home-manager/theme/default.nix create mode 100644 modules/home-manager/theme/integrations/kitty/default.mustache create mode 100644 modules/home-manager/theme/integrations/kitty/default.nix diff --git a/hosts/MONSTER/home.nix b/hosts/MONSTER/home.nix index c915eb0..69220a2 100644 --- a/hosts/MONSTER/home.nix +++ b/hosts/MONSTER/home.nix @@ -1 +1,4 @@ -{ ... }: { } +{ ... }: +{ + theme.base16.enable = true; +} diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix index b7a8a97..fbbc28b 100644 --- a/modules/home-manager/default.nix +++ b/modules/home-manager/default.nix @@ -1,7 +1,5 @@ { username, - desktop, - stateVersion, osConfig, inputs, ... @@ -18,7 +16,9 @@ inputs.anyrun.homeManagerModules.default ./clean-home-dir.nix ./programs/neovide.nix - # ./default-apps.nix + + ./theme + ./packages ./programs ./services diff --git a/modules/home-manager/desktops/hyprland/kitty.nix b/modules/home-manager/desktops/hyprland/kitty.nix index eee3d74..d09393b 100644 --- a/modules/home-manager/desktops/hyprland/kitty.nix +++ b/modules/home-manager/desktops/hyprland/kitty.nix @@ -6,8 +6,6 @@ symbol_map U+23FB-U+23FE,U+2665,U+26A1,U+2B58,U+E000-U+E00A,U+E0A0-U+E0A3,U+E0B0-U+E0D4,U+E200-U+E2A9,U+E300-U+E3E3,U+E5FA-U+E6AA,U+E700-U+E7C5,U+EA60-U+EBEB,U+F000-U+F2E0,U+F300-U+F32F,U+F400-U+F4A9,U+F500-U+F8FF,U+F0001-U+F1AF0 Symbols Nerd Font Mono font_size 13 - - include ./current-theme.conf ''; settings = { background_opacity = "0.8"; diff --git a/modules/home-manager/theme/default.nix b/modules/home-manager/theme/default.nix new file mode 100644 index 0000000..5e32a42 --- /dev/null +++ b/modules/home-manager/theme/default.nix @@ -0,0 +1,37 @@ +{ + config, + lib, + pkgs, + ... +}: + +with lib; + +let + cfg = config.theme.base16; +in +{ + imports = [ ./integrations/kitty ]; + + options.theme.base16 = { + enable = mkEnableOption "Enable a global base16 theme"; + options = { + shell = mkOption { + type = types.string; + default = "bash -c '{}'"; + }; + items = mkOption { + type = types.listOf types.attrs; + default = [ ]; + }; + }; + }; + + config = mkIf cfg.enable { + home.packages = with pkgs; [ flavours ]; + + xdg.configFile."flavours/config.toml".source = + (pkgs.formats.toml { }).generate "config.toml" + cfg.options; + }; +} diff --git a/modules/home-manager/theme/integrations/kitty/default.mustache b/modules/home-manager/theme/integrations/kitty/default.mustache new file mode 100644 index 0000000..830fa97 --- /dev/null +++ b/modules/home-manager/theme/integrations/kitty/default.mustache @@ -0,0 +1,35 @@ +# Base16 {{scheme-name}} - kitty color config +# Scheme by {{scheme-author}} +background #{{base00-hex}} +foreground #{{base05-hex}} +selection_background #{{base05-hex}} +selection_foreground #{{base00-hex}} +url_color #{{base04-hex}} +cursor #{{base05-hex}} +active_border_color #{{base03-hex}} +inactive_border_color #{{base01-hex}} +active_tab_background #{{base00-hex}} +active_tab_foreground #{{base05-hex}} +inactive_tab_background #{{base01-hex}} +inactive_tab_foreground #{{base04-hex}} +tab_bar_background #{{base01-hex}} + +# normal +color0 #{{base00-hex}} +color1 #{{base08-hex}} +color2 #{{base0B-hex}} +color3 #{{base0A-hex}} +color4 #{{base0D-hex}} +color5 #{{base0E-hex}} +color6 #{{base0C-hex}} +color7 #{{base05-hex}} + +# bright +color8 #{{base03-hex}} +color9 #{{base09-hex}} +color10 #{{base01-hex}} +color11 #{{base02-hex}} +color12 #{{base04-hex}} +color13 #{{base06-hex}} +color14 #{{base0F-hex}} +color15 #{{base07-hex}} diff --git a/modules/home-manager/theme/integrations/kitty/default.nix b/modules/home-manager/theme/integrations/kitty/default.nix new file mode 100644 index 0000000..af2b3f8 --- /dev/null +++ b/modules/home-manager/theme/integrations/kitty/default.nix @@ -0,0 +1,25 @@ +{ config, lib, ... }: + +with lib; + +let + cfg = config.theme.base16; +in +{ + config = mkIf cfg.enable { + programs.kitty.extraConfig = '' + include ./current-theme.conf + ''; + + xdg.configFile."flavours/templates/kitty/templates/default.mustache".source = ./default.mustache; + + theme.base16.options.items = [ + { + file = "${config.xdg.configHome}/kitty/current-theme.conf"; + template = "kitty"; + hook = "kill -SIGUSR1 $(pgrep kitty)"; + rewrite = true; + } + ]; + }; +}