# Bat — cat replacement with nix-colors syntax highlighting theme. { config, lib, pkgs, ... }: with lib; let cfg = config.base.cliTools.bat; palette = config.colorScheme.palette; in { options.base.cliTools.bat.enable = mkEnableOption "enable bat with nix-colors theme"; config = mkIf cfg.enable { programs.bat = { enable = true; config = {theme = "universal";}; themes = { universal = { src = pkgs.writeText "universal.tmTheme" '' name Universal (nix-colors) settings settings background #${palette.base00} foreground #${palette.base05} caret #${palette.base05} selection #${palette.base02} selectionForeground #${palette.base05} lineHighlight #${palette.base01} name Comment scope comment settings foreground #${palette.base03} fontStyle italic name String scope string settings foreground #${palette.base0A} name Number scope constant.numeric settings foreground #${palette.base0E} name Keyword scope keyword settings foreground #${palette.base08} name Function scope entity.name.function settings foreground #${palette.base0B} name Type scope entity.name.type, storage.type settings foreground #${palette.base0D} name Variable scope variable settings foreground #${palette.base05} name Constant scope constant settings foreground #${palette.base0E} ''; }; }; }; }; }