Update alacritty config to generate theme dynamically

This commit is contained in:
Evie Litherland-Smith 2024-06-07 13:36:29 +01:00
parent 15199580e9
commit 0a9f7157fc
2 changed files with 66 additions and 99 deletions

View file

@ -1,75 +0,0 @@
[colors.primary]
background = "#1E1E2E"
foreground = "#CDD6F4"
dim_foreground = "#CDD6F4"
bright_foreground = "#CDD6F4"
[colors.cursor]
text = "#1E1E2E"
cursor = "#F5E0DC"
[colors.vi_mode_cursor]
text = "#1E1E2E"
cursor = "#B4BEFE"
[colors.search.matches]
foreground = "#1E1E2E"
background = "#A6ADC8"
[colors.search.focused_match]
foreground = "#1E1E2E"
background = "#A6E3A1"
[colors.footer_bar]
foreground = "#1E1E2E"
background = "#A6ADC8"
[colors.hints.start]
foreground = "#1E1E2E"
background = "#F9E2AF"
[colors.hints.end]
foreground = "#1E1E2E"
background = "#A6ADC8"
[colors.selection]
text = "#1E1E2E"
background = "#F5E0DC"
[colors.normal]
black = "#45475A"
red = "#F38BA8"
green = "#A6E3A1"
yellow = "#F9E2AF"
blue = "#89B4FA"
magenta = "#F5C2E7"
cyan = "#94E2D5"
white = "#BAC2DE"
[colors.bright]
black = "#585B70"
red = "#F38BA8"
green = "#A6E3A1"
yellow = "#F9E2AF"
blue = "#89B4FA"
magenta = "#F5C2E7"
cyan = "#94E2D5"
white = "#A6ADC8"
[colors.dim]
black = "#45475A"
red = "#F38BA8"
green = "#A6E3A1"
yellow = "#F9E2AF"
blue = "#89B4FA"
magenta = "#F5C2E7"
cyan = "#94E2D5"
white = "#BAC2DE"
[[colors.indexed_colors]]
index = 16
color = "#FAB387"
[[colors.indexed_colors]]
index = 17
color = "#F5E0DC"

View file

@ -1,29 +1,71 @@
{fonts, ...}: {
programs.alacritty = let
catppuccin-mocha = builtins.fromTOML (builtins.readFile ./catppuccin-mocha.toml);
in {
{
config,
fonts,
...
}: {
programs.alacritty = {
enable = true;
settings =
{
font = {
size = fonts.sizes.applications;
normal = {
family = fonts.monospace.name;
style = "Regular";
};
settings = {
font = {
size = fonts.sizes.applications;
normal = {
family = fonts.monospace.name;
style = "Regular";
};
window = {
dynamic_title = true;
padding = {
x = 10;
y = 10;
};
decorations = "none";
};
window = {
dynamic_title = true;
padding = {
x = 10;
y = 10;
};
live_config_reload = false;
selection.save_to_clipboard = true;
mouse.hide_when_typing = false;
}
// catppuccin-mocha;
decorations = "none";
opacity = 0.9;
};
live_config_reload = true;
selection.save_to_clipboard = true;
mouse.hide_when_typing = true;
colors = let
mapColours = isBright: (builtins.listToAttrs (builtins.map (col: {
# Alacritty uses Yellow instead of Orange for BASE09
name =
if col == "orange"
then "yellow"
else col;
value = "0x${config
.scheme
.${
if isBright
then "bright-${col}"
else col
}}";
})
["red" "orange" "green" "cyan" "blue" "magenta"]));
mapNamedColours = mapColours false;
mapNamedBrightColours = mapColours true;
in {
draw_bold_text_with_bright_colors = false;
primary = with config.scheme; {
background = "0x${base00}";
foreground = "0x${base05}";
};
cursor = with config.scheme; {
cursor = "0x${base05}";
text = "0x${base00}";
};
normal = with config.scheme;
{
black = "0x${base00-hex}";
white = "0x${base05-hex}";
}
// mapNamedColours;
bright = with config.scheme;
{
black = "0x${base03-hex}";
white = "0x${base07-hex}";
}
// mapNamedBrightColours;
};
};
};
}