alacritty: replace base16-alacritty with a custom theme (#346)

Replaces mustache template with a theme specified using
Home Manager options. This removes the need for separate
templates for TOML and YAML formats.

The new colors better align with other terminal modules (e.g. wezterm),
and base24 schemes with bright- mnemonics are now supported.

Closes #341.
This commit is contained in:
Sergei Zimmerman 2024-04-22 16:17:05 +03:00 committed by GitHub
parent 845c674510
commit 2f29ecd3e4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 37 additions and 61 deletions

View file

@ -18,39 +18,6 @@
"type": "github" "type": "github"
} }
}, },
"base16-alacritty": {
"flake": false,
"locked": {
"lastModified": 1703982197,
"narHash": "sha256-TNxKbwdiUXGi4Z4chT72l3mt3GSvOcz6NZsUH8bQU/k=",
"owner": "aarowill",
"repo": "base16-alacritty",
"rev": "c95c200b3af739708455a03b5d185d3d2d263c6e",
"type": "github"
},
"original": {
"owner": "aarowill",
"repo": "base16-alacritty",
"type": "github"
}
},
"base16-alacritty-yaml": {
"flake": false,
"locked": {
"lastModified": 1674275109,
"narHash": "sha256-Adwx9yP70I6mJrjjODOgZJjt4OPPe8gJu7UuBboXO4M=",
"owner": "aarowill",
"repo": "base16-alacritty",
"rev": "63d8ae5dfefe5db825dd4c699d0cdc2fc2c3eaf7",
"type": "github"
},
"original": {
"owner": "aarowill",
"repo": "base16-alacritty",
"rev": "63d8ae5dfefe5db825dd4c699d0cdc2fc2c3eaf7",
"type": "github"
}
},
"base16-fish": { "base16-fish": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -235,8 +202,6 @@
"root": { "root": {
"inputs": { "inputs": {
"base16": "base16", "base16": "base16",
"base16-alacritty": "base16-alacritty",
"base16-alacritty-yaml": "base16-alacritty-yaml",
"base16-fish": "base16-fish", "base16-fish": "base16-fish",
"base16-foot": "base16-foot", "base16-foot": "base16-foot",
"base16-helix": "base16-helix", "base16-helix": "base16-helix",

View file

@ -1,15 +1,5 @@
{ {
inputs = { inputs = {
base16-alacritty = {
flake = false;
url = "github:aarowill/base16-alacritty";
};
base16-alacritty-yaml = {
flake = false;
url = "github:aarowill/base16-alacritty/63d8ae5dfefe5db825dd4c699d0cdc2fc2c3eaf7";
};
base16-fish = { base16-fish = {
flake = false; flake = false;
url = "github:tomyun/base16-fish"; url = "github:tomyun/base16-fish";

View file

@ -1,23 +1,17 @@
{pkgs, config, lib, ... }: # Documentation is available at:
# - https://alacritty.org/config-alacritty.html
with config.stylix.fonts; # - `man 5 alacritty`
{ config, lib, ... }:
let let
useYaml = (builtins.compareVersions config.programs.alacritty.package.version "0.13.0") < 0; colors = config.lib.stylix.colors.withHashtag;
templateRepo = config.lib.stylix.templates.
"base16-alacritty${if useYaml then "-yaml" else ""}";
themeFile = config.lib.stylix.colors {
inherit templateRepo;
};
in in
{ {
options.stylix.targets.alacritty.enable = options.stylix.targets.alacritty.enable = config.lib.stylix.mkEnableTarget "Alacritty" true;
config.lib.stylix.mkEnableTarget "Alacritty" true;
config = lib.mkIf config.stylix.targets.alacritty.enable { config = lib.mkIf config.stylix.targets.alacritty.enable {
programs.alacritty.settings = { programs.alacritty.settings = {
font = { font = with config.stylix.fonts; {
normal = { normal = {
family = monospace.name; family = monospace.name;
style = "Regular"; style = "Regular";
@ -25,7 +19,36 @@ in
size = sizes.terminal; size = sizes.terminal;
}; };
window.opacity = with config.stylix.opacity; terminal; window.opacity = with config.stylix.opacity; terminal;
import = [ themeFile ]; colors = with colors; {
primary = {
foreground = base05;
background = base00;
bright_foreground = base07;
};
selection = {
text = base05;
background = base02;
};
cursor = {
text = base00;
cursor = base05;
};
normal = {
black = base00;
white = base05;
inherit red green yellow blue magenta cyan;
};
bright = {
black = base03;
white = base07;
red = bright-red;
green = bright-green;
yellow = yellow;
blue = bright-blue;
magenta = bright-magenta;
cyan = bright-cyan;
};
};
}; };
}; };
} }

View file

@ -2,8 +2,6 @@ inputs:
{ {
config.lib.stylix.templates = { config.lib.stylix.templates = {
inherit (inputs) inherit (inputs)
base16-alacritty
base16-alacritty-yaml
base16-fish base16-fish
base16-foot base16-foot
base16-helix base16-helix