Skip to content

Commit

Permalink
Fix missing cyan in console iceberg and prefer NixOS colors module
Browse files Browse the repository at this point in the history
Refine #665
  • Loading branch information
kachick committed Aug 5, 2024
1 parent 6936032 commit 7e2f3f6
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 40 deletions.
4 changes: 0 additions & 4 deletions home-manager/bash.nix
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,6 @@
${lib.getBin pkgs.coreutils}/bin/stty stop undef
source "${homemade-pkgs.posix_shared_functions}"
if [ 'linux' = "$TERM" ]; then
apply_iceberg
fi
''
+ builtins.readFile ./initExtra.bash;

Expand Down
4 changes: 0 additions & 4 deletions home-manager/zsh.nix
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,6 @@
source_sh "${homemade-pkgs.posix_shared_functions}"
if [ 'linux' = "$TERM" ]; then
apply_iceberg
fi
# https://superuser.com/a/902508/120469
# https://github.com/zsh-users/zsh-autosuggestions/issues/259
zshaddhistory() { whence ''${''${(z)1}[1]} >| /dev/null || return 1 }
Expand Down
55 changes: 55 additions & 0 deletions nixos/console.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

{ homemade-pkgs, ... }:
{
# https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/config/console.nix
# https://wiki.archlinux.org/title/Linux_console
console = {
earlySetup = true;
Expand All @@ -13,5 +14,59 @@

packages = with homemade-pkgs; [ cozette ];
keyMap = "us";

# Applying iceberg for 16(0-15) console colors
# Original schema is shared in https://gist.github.com/cocopon/1d481941907d12db7a0df2f8806cfd41
# You can test as `echo -en "\e]P484a0c6"` the P4's "4" means blue. It is same as 0 start index 4 in this list
# In hex, 12 will be C as "PC91acd1" for 12 index bright blue.
colors = [
# 0 - black
"1e2132"

# 1 - red
"e27878"

# 2 - green
"b4be82"

# 3 - yellow
"e2a478"

# 4 - blue. Should be changed to avoid unreadable ANSI blue. See GH-660
"84a0c6"

# 5 - magenta
"a093c7"

# 6 - cyan
"89b8c2"

# 7 - white
"c6c8d1"

# 8 - bright black
"6b7089"

# 9 - bright red
"e98989"

# 10 - bright green
"c0ca8e"

# 11 - bright yellow
"e9b189"

# 12 - bright blue
"91acd1"

# 13 -bright magenta
"ada0d3"

# 14 - bright cyan
"95c4ce"

# 15 - bright white
"d2d4de"
];
};
}
32 changes: 0 additions & 32 deletions pkgs/posix_shared_functions/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -35,36 +35,4 @@ pkgs.writeText "posix_shared_functions.sh" ''
gch() {
fc -nrl 1 | ${lib.getExe fzf-bind-posix-shell-history-to-git-commit-message}
}
# See the reason in GH-660
# Original scheme: https://gist.github.com/cocopon/1d481941907d12db7a0df2f8806cfd41
apply_iceberg() {
# Blue. Mandatory to be changed from ANSI
echo -en "\e]P484a0c6"
echo -en "\e]PC91acd1"
# Black
echo -en "\e]P01e2132"
echo -en "\e]P86b7089"
# Red
echo -en "\e]P1e27878"
echo -en "\e]P9e98989"
# Green
echo -en "\e]P2b4be82"
echo -en "\e]PAc0ca8e"
# Yellow
echo -en "\e]P3e2a478"
echo -en "\e]PBe9b189"
# Magenta
echo -en "\e]P5a093c7"
echo -en "\e]PDada0d3"
# White
echo -en "\e]P7c6c8d1"
echo -en "\e]PFd2d4de"
}
''

0 comments on commit 7e2f3f6

Please sign in to comment.