如何在任何来源的所有 STDOUT/STDERR 中查找/替换特定的 ANSI 转义码

问题描述

我的终端背景颜色是深蓝色。

我使用的一些工具会发出深蓝色文本,使我看不到文本。

我能否在我的 .zshrc添加一些内容,以便从任何/每个来源读取所有 STDOUT/STDERR 并自动将任何深蓝色 ANSI 转义码替换为白色?

来自我的alacritty.yml

colors:
  primary:
    background: '0x002b36'
    foreground: '0x839496'
    dim_background: '0x002b36'
    dim_foreground: '0x839496'
    bright_background: '0x002b36'
    bright_foreground: '0x839496'
  cursor:
    text:   '#002b36' # base03
    cursor: '#839496' # base0
  normal:
    black: '0x073642'
    red: '0xdc322f'
    green: '0x859900'
    yellow: '0xb58900'
    blue: '0x268bd2'
    magenta: '0xd33682'
    cyan: '0x2aa198'
    white: '0xeee8d5'
  bright:
    black: '0x002b36'
    red: '0xcb4b16'
    green: '0x586e75'
    yellow: '0x657b83'
    blue: '0x839496'
    magenta: '0x6c71c4'
    cyan: '0x93a1a1'
    white: '0xfdf6e3'

来自我的.zshrc

autoload -U colors
colors

解决方法

嗯,不,不是来自您的 .zshrc 文件,但您可以编辑您的 alacritty.yml 文件。在那里,在 normal: 下,将 blue: 的值替换为您选择的另一个值。您可以在随 Alacritty 分发的 example alacritty.yml file 中阅读有关设置这些值的更多信息。