zsh: factor out the colors to avoid repeating them

This commit is contained in:
2023-07-18 10:14:13 +00:00
parent 532a78e2b2
commit 91f47f863d

View File

@@ -6,6 +6,15 @@
let let
enabled = config.sane.zsh.starship; enabled = config.sane.zsh.starship;
toml = pkgs.formats.toml {}; toml = pkgs.formats.toml {};
colors = {
# colors sorted by the order they appear in the status bar
_01_purple = "#9A348E";
_02_pink = "#DA627D";
_03_orange = "#FCA17D";
_04_teal = "#86BBD8";
_05_blue = "#06969A";
_06_blue = "#33658A";
};
in { in {
config = lib.mkIf config.sane.zsh.starship { config = lib.mkIf config.sane.zsh.starship {
sane.programs.zsh = lib.mkIf enabled { sane.programs.zsh = lib.mkIf enabled {
@@ -14,49 +23,49 @@ in {
''; '';
fs.".config/starship.toml".symlink.target = toml.generate "starship.toml" { fs.".config/starship.toml".symlink.target = toml.generate "starship.toml" {
format = builtins.concatStringsSep "" [ format = builtins.concatStringsSep "" [
"[](#9A348E)" "[](${colors._01_purple})"
"$os" "$os"
"$username" "$username"
"$hostname" "$hostname"
"[](bg:#DA627D fg:#9A348E)" "[](bg:${colors._02_pink} fg:${colors._01_purple})"
"$directory" "$directory"
"[](fg:#DA627D bg:#FCA17D)" "[](fg:${colors._02_pink} bg:${colors._03_orange})"
"$git_branch" "$git_branch"
"$git_status" "$git_status"
"[](fg:#FCA17D bg:#86BBD8)" "[](fg:${colors._03_orange} bg:${colors._04_teal})"
"[](fg:#86BBD8 bg:#06969A)" "[](fg:${colors._04_teal} bg:${colors._05_blue})"
"[](fg:#06969A bg:#33658A)" "[](fg:${colors._05_blue} bg:${colors._06_blue})"
"$time" "$time"
"$status" "$status"
"[ ](fg:#33658A)" "[ ](fg:${colors._06_blue})"
]; ];
add_newline = false; # no blank line before prompt add_newline = false; # no blank line before prompt
os.style = "bg:#9A348E"; os.style = "bg:${colors._01_purple}";
os.format = "[$symbol]($style)"; os.format = "[$symbol]($style)";
os.disabled = false; os.disabled = false;
# os.symbols.NixOS = "❄️"; # removes the space after logo # os.symbols.NixOS = "❄️"; # removes the space after logo
# TODO: tune foreground color of username # TODO: tune foreground color of username
username.style_user = "bg:#9A348E"; username.style_user = "bg:${colors._01_purple}";
username.style_root = "bold bg:#9A348E"; username.style_root = "bold bg:${colors._01_purple}";
username.format = "[$user]($style)"; username.format = "[$user]($style)";
hostname.style = "bold bg:#9A348E"; hostname.style = "bold bg:${colors._01_purple}";
hostname.format = "[$ssh_symbol$hostname]($style)"; hostname.format = "[$ssh_symbol$hostname]($style)";
directory.style = "bg:#DA627D fg:#ffffff"; directory.style = "bg:${colors._02_pink} fg:#ffffff";
directory.format = "[ $path ]($style)"; directory.format = "[ $path ]($style)";
directory.truncation_length = 3; directory.truncation_length = 3;
directory.truncation_symbol = "/"; directory.truncation_symbol = "/";
# git_branch.symbol = ""; # looks good in nerd fonts # git_branch.symbol = ""; # looks good in nerd fonts
git_branch.symbol = ""; git_branch.symbol = "";
git_branch.style = "bg:#FCA17D fg:#ffffff"; git_branch.style = "bg:${colors._03_orange} fg:#ffffff";
# git_branch.style = "bg:#FF8262"; # git_branch.style = "bg:#FF8262";
git_branch.format = "[ $symbol $branch ]($style)"; git_branch.format = "[ $symbol $branch ]($style)";
git_status.style = "bold bg:#FCA17D fg:#ffffff"; git_status.style = "bold bg:${colors._03_orange} fg:#ffffff";
# git_status.style = "bg:#FF8262"; # git_status.style = "bg:#FF8262";
git_status.format = "[$all_status$ahead_behind ]($style)"; git_status.format = "[$all_status$ahead_behind ]($style)";
git_status.ahead = "$count"; git_status.ahead = "$count";
@@ -70,11 +79,11 @@ in {
time.disabled = true; time.disabled = true;
time.time_format = "%R"; # Hour:Minute Format time.time_format = "%R"; # Hour:Minute Format
time.style = "bg:#33658A"; time.style = "bg:${colors._06_blue}";
time.format = "[ $time ]($style)"; time.format = "[ $time ]($style)";
status.disabled = false; status.disabled = false;
status.style = "bg:#33658A"; status.style = "bg:${colors._06_blue}";
# status.success_symbol = "♥ "; # status.success_symbol = "♥ ";
# status.success_symbol = "💖"; # status.success_symbol = "💖";
# status.success_symbol = "💙"; # status.success_symbol = "💙";