【问题标题】:PhpStorm console does not support ANSI colorsPhpStorm 控制台不支持 ANSI 颜色
【发布时间】:2017-10-16 10:34:54
【问题描述】:

我在使用 PhpStorm 控制台时遇到问题:它不支持 ANSI 颜色。

有什么对我有帮助的建议吗?

控制台是这样的

【问题讨论】:

  • 在独立终端应用程序中可以正常工作吗?
  • @VladLuchansky 是的,我也在 git bash 中测试过,看起来一样
  • 好吧,如果它与独立 bash 相同,那么您需要检查其配置。 PhpStorm 只是封装了一个终端应用程序,它对渲染文本或其颜色没有什么作用。

标签: php console phpstorm ansi


【解决方案1】:

你可以在你的 .bashrc 文件中使用这个脚本来着色提示:

# Customize Bash settings.
cat <<EOF > /home/vagrant/.bashrc
# Colorize the prompt.
yellow=\$(tput setaf 3)
green=\$(tput setaf 2)
blue=\$(tput setaf 104)
bold=\$(tput bold)
reset=\$(tput sgr0)

PS1="\[\$yellow\]\u\[\$reset\]@\[\$green\]\h\[\$reset\]:\[\$blue\$bold\]\w\[\$reset\]\$ "

# Don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options.
export HISTCONTROL=ignoreboth

# Append to the history file, don't overwrite it.
shopt -s histappend

# History size up to 1000 commands.
export HISTSIZE=1000

# Make less more friendly for non-text input files, see lesspipe(1).
[ -x /usr/bin/lesspipe ] && eval "\$(SHELL=/bin/sh lesspipe)"

# Enable color support of ls and also add handy aliases.
export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad
if [ -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "\$(dircolors -b ~/.dircolors)" || eval "\$(dircolors -b)"
    alias ls='ls --color=auto'
    alias grep='grep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias egrep='egrep --color=auto'
fi

# Enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
    . /etc/bash_completion
fi

# Set your favorite editor here.
VISUAL=vim; export VISUAL
EDITOR=vim; export EDITOR

# Append /usr/local/bin to the path.
export PATH=/usr/local/bin:/usr/local/share/python/:\$PATH
EOF

【讨论】:

  • 恐怕这不会帮助我将它添加到该文件中,但它不会显示数字的 php artisan 命令颜色
猜你喜欢
  • 2021-01-02
  • 1970-01-01
  • 2011-03-17
  • 2010-09-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-09-11
  • 2020-08-29
相关资源
最近更新 更多