无法在ConEmu中启用256色 [英] Can't enable 256 colors in ConEmu
问题描述
我正在尝试在出色的 ConEmu-Maximus5 控制台中获得256种颜色
I'm trying to get 256 colors in the fantastic ConEmu-Maximus5 console.
更新:现在它仅显示8种颜色.我知道,因为"$ tput颜色"输出为"8"
Update: Now it only shows 8 colors. I know because '$tput colors' output is '8'
function prompt {
local RED="\[\033[0;31m\]"
local GREEN="\[\033[0;32m\]"
local COOLRED="\e[38;5;173m"
local COOLGREEN="\e[38;5;113m"
PS1="$COOLRED\u@\h $LIGHT_COOLGREEN\$PWD \[\e[0m\] > "
}
prompt
- 顺便说一下,ConEmuANSI的值为ON.
我有一些屏幕截图:
如您所见,命令提示符看起来非常奢侈,因为它不喜欢256色设置.如果我将变量COOLRED和COOLGREEN替换为RED和GREEN,则看起来还可以,但不是256色.
As you can see the command prompt looks very extravagant because it doesn't like the 256 color settings. If i substitute the variables COOLRED and COOLGREEN with RED and GREEN, then it looks ok, but it's not 256 colors.
更多设置截图:
最后一个镜头是Cygwin的薄荷味.那里一切都很好.支持全256色.可惜的是薄荷没有标签.这主要是我要迁移到ConEmu的原因.
And the last sceen shot it's cygwin's mintty. Everything is ok there. Full 256 color supported. It's a shame mintty doesn't have tabs. That's mostly the reason why I'm trying to move to ConEmu.
非常感谢您的帮助!!!
Thank you very much for helping!!!
推荐答案
Bash不会将ANSI序列发送到控制台.它试图自己处理它们.而且,由于* nix终端通常只有8色(不考虑256色模式),因此bash使用8色调色板而不是Windows终端常见的16色调色板.
Bash does not send ANSI sequences to console. It tries to process them itself. And, because *nix terminal is generally only 8-color (not taking into account 256-color mode), bash uses 8-color palette instead of 16-color palette which is common to Windows terminal.
我认为256色具有薄荷味,因为_isatty
在该终端中返回零.但是它在ConEmu下返回非零值.可能在将来的版本中,我解决了这个难题(如何为某些应用程序创建具有PTY功能的真实终端).
I think, 256-colors works in mintty because _isatty
returns zero in that terminal. But it returns non zero value under ConEmu. May be in future builds I solve this puzzle (how to create real terminal with PTY features for some applications).
关于这个问题
实际上,您不需要256色.要重新定义提示调色板,您可以使用使用背景扩展前景色"功能.在breaf中-在ConEmu中设置颜色16、17等,在bash中将提示背景设置为#5(在ConEmu中可配置),然后瞧.
You have no need in 256-colors In fact. To redefine prompt palette you may use "Extend foreground colors with background" feature. In breaf - set up colors 16, 17, etc. in ConEmu, set prompt background in bash to #5 (configurable in ConEmu), and voila.
ConEmu扩展..."处理中存在一个小错误.使用内部版本121016或更高版本.
There was a small bug in ConEmu "Extend..." processing. Use build 121016 or later.
PS1="\e[30;45m\u@\h \e[34;45m$PWD \[\e[0m\] > "
以下信息与问题不符,但可能有用
当前版本在整个"控制台缓冲区中不支持256色模式(限制,是的,请在计划中删除它).
Current version does not support 256-color mode in 'whole' console buffer (limitation, yes, removing it in plans).
所以,您可以选择2种方式
So, you can go 2 ways
- 完全禁用回滚缓冲区(许多方式,例如"cmd -cur_console:h0")
- 在滚动缓冲区的底部工作.
这篇关于无法在ConEmu中启用256色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!