在 Cygwin 中如何更改字体颜色?

发布于 2024-07-13 11:34:07 字数 78 浏览 4 评论 0原文

我想开始使用 Cygwin,但我对字体颜色不满意,想将其更改为黑色背景的浅绿色。

(顺便说一句,我尝试谷歌搜索但无济于事)

I want to start using Cygwin, but I am not pleased with the font color and would like to change it to light green with a black background.

(I tried googling to no avail BTW)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(10

彩扇题诗 2024-07-20 11:34:07

它基本上只是一个 DOS 窗口。 因此,单击 shell 窗口左上角的图标即可获取菜单。 转到属性。 然后,您可以更改颜色、字体、命令历史记录和编辑选项(您将需要打开快速编辑和插入模式)。

It is basically just a DOS window. So click on the icon in the upper left of the shell window to get the menu. Go to properties. You can then change the colors, font, command history, and edit options (you will want to turn on Quick Edit and Insert modes).

独木成林 2024-07-20 11:34:07

我自己发现标准 shell 非常糟糕。

我下载并安装 rxvt 软件包并更改 cygwin.bat 以启动 rxvt,它对复制剪切粘贴有更好的支持。

@echo off
c:
chdir c:\data\cygwin\bin
set EDITOR=vi
set VISUAL=vi
set CYGWIN=codepage:ansi
rxvt -fn '*-courier-*-r-*-16-*' -sl  9999 -bg Black -fg Cyan -e /bin/bash -login

-e 和 -login 将启动 shell 切换到 rxvt 以及其余的:
-fn 设置 courier 大小 16 字体(告我吧)
-sl 滚动行数为 9999
黑色背景和青色前景
选择文本将自动填充粘贴缓冲区
最后一位 (-e /bin/bash -login) 启动 bash 并告诉它它是一个运行配置文件设置等的登录 shell。

I find the standard shell to be pretty horrible myself.

I download and install the rxvt package and change the cygwin.bat to launch rxvt which has nicer support of copy-cut-n-paste.

@echo off
c:
chdir c:\data\cygwin\bin
set EDITOR=vi
set VISUAL=vi
set CYGWIN=codepage:ansi
rxvt -fn '*-courier-*-r-*-16-*' -sl  9999 -bg Black -fg Cyan -e /bin/bash -login

The -e and -login switch the launch shell to the rxvt one and the rest:
-fn sets a courier size 16 font (sue me)
-sl scroll lines of 9999
Black background and Cyan foreground
selecting text will fill the paste buffer automatically
the last bit (-e /bin/bash -login) launches bash and tells it that its a login shell which runs the profile setups and such.

誰認得朕 2024-07-20 11:34:07

如果您想要一个比 Windows 命令行窗口更好的终端与 cygwin 一起使用,您可以从 cygwin 中启动 xterm,或者查看使用 puttycyg,它是 Windows ssh 客户端 putty 的修补版本,旨在与本地 cygwin 安装一起使用(除了正常的 ssh 功能之外)。 puttycyg 应该为您提供比 Windows 命令行窗口更好的终端控制。

If you want a better terminal to use with cygwin than the Windows Command Line window you could start xterm from within cygwin, or look at using puttycyg, which is a patched version of the windows ssh client putty designed to work with a local cygwin installation (in addition to the normal ssh functionality). puttycyg should provide you with much better control of your terminal than the Windows Command Line window.

原野 2024-07-20 11:34:07

虽然其他人建议使用不同的终端,但默认的 Cygwin 终端仿真器 (mintty) 允许您自行更改颜色。 您可以通过选项对话框更改前景色、背景色和光标颜色。 您可以通过单击上下文菜单(窗口左上角的图标)找到选项对话框。

其余的 ANSI 颜色只能从配置文件 (~/.minttyrc) 更改。 不幸的是,此文件的参考确实不包含示例,因此需要一些猜测。 您可以在 github 上找到我的示例。 我只增加了蓝色的亮度。 还有一个存储库,其中包含一个存储库。 com/mavnn/mintty-colors-solarized/blob/master/.minttyrc.light" rel="noreferrer">light 和 深色 solarized 主题。 您可以使用这些来获取灵感。

顺便说一句,在我的例子中,更改 Blue 的定义似乎没有改变任何事情,但更改 BoldBlue 改变了粗体和默认变体。 我花了一段时间才弄清楚这一点...我不断地更改 Blue 并且因为没有发生任何事情,我被其他细节转移了注意力(例如:Term=xterm- 256color & co)...也许我读的文档不适用于我正在运行的同一 Cygwin 版本。 当你摆弄你的主题时,你应该记住这一点。

编辑文件后,关闭并重新打开 Cygwin 终端,新的颜色应该会显示。

哦...对于您最初的请求(黑底绿),您唯一需要的是:

ForegroundColour=0, 255, 0
BackgroundColour=0, 0, 0

但是您应该考虑将默认前景色保留为白色(或浅灰色),除非您将全部更改为还有其他颜色代码! 某些应用程序打印彩色输出,并且您不会看到“绿色”,因为其他所有内容也是绿色的:)但是,Cygwin 中绿色的默认颜色是 rgb:0,191,0 code>,所以如果您使用其他东西(例如提到的 rgb:0,255,0),您至少会看到亮度的差异。

While others suggest to use a different terminal, the default Cygwin terminal emulator (mintty) lets you change the colors itself. You can change the foreground, background and cursor colors via the options dialog. You can find the options dialog by clicking on the context menu (the icon in the upper left of the window).

The remaining ANSI colors can only be changed from the config file (~/.minttyrc). Unfortunately the reference for this file does not contain an example, so a bit of guesswork is needed. You can find my example over on github. I only increased the brightness for blue. There is also a repo which contains the light and dark themes of solarized. You use these for inspiration.

On a side-note, in my case it seemed that changing the definition of Blue did not change a thing, but changing BoldBlue changed both the bold and default variant. It took me a while to figure this out... I kept changing Blue and because nothing was happening, I got side-tracked by other details (f.ex.: Term=xterm-256color & co)... Maybe the docs I read are are not for the same Cygwin version I am running. You should keep this in mind when fiddling around with your theme.

After editing the file, close and re-open the Cygwin terminal and the new colors should show up.

Oh... and for your original request (green on black), the only thing you need is:

ForegroundColour=0, 255, 0
BackgroundColour=0, 0, 0

But you should consider keeping the default foreground colour to white (or light gray) unless you change all the other colour codes as well! Some application print colorised output, and you will not see "green", because everything else is green too :) However, the default color for green in Cygwin is rgb:0,191,0, so if you use something else (like the mentioned rgb:0,255,0) you will at least see a difference in brightness.

灯下孤影 2024-07-20 11:34:07

我建议使用 Console2。 这为您提供了一个选项卡式界面,您可以在其中同时拥有 Cygwin 选项卡和 Windows 命令提示符选项卡。 有很多自定义选项,以及更好的剪切和粘贴支持。

I'd recommend using Console2. This gives you a tabbed interface where you can have both Cygwin tabs and Windows Command prompt tabs. There's lots of customisation options, and much better cut and paste support.

掩于岁月 2024-07-20 11:34:07

cygwin 图标实际上只是一个 MS-DOS 批处理文件(如果右键单击它,可以对其进行编辑,并看到它只是从 cygwin\bin 目录启动 bash)。 如果右键单击并转到“属性”,则会出现一个“颜色”选项卡,您可以在其中更改背景和字体颜色。 如果您修改主要快捷方式属性,则每次都会使用这些属性启动。

The cygwin icon is actually just a MS-DOS batch file (if you right-click on it, you can edit it and see that it just launches bash from the cygwin\bin directory). If you right-click and go to Properties, there's a Colors tab where you can change the background and font colors. If you modify the main shortcut properties, it should launch with those every time.

瘫痪情歌 2024-07-20 11:34:07

我使用 Cygwin 的 rxvt 和 .Xdefaults 文件来调整

我的 cygwin.bat:

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::
@echo off

start /B \cygwin\bin\rxvt.exe -geometry 80x40+325+195 -fn "Andale Mono-13" -sl 2500 -e /bin/bash -i
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::


My Cygwin .Xdefaults:

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! See rxvt --help for items available

! Black
Rxvt*background: #000000
Rxvt*cutchars: `"'()*,;<>[]{|}@
!!!Rxvt*cursorColor: #00ff00
Rxvt*cursorColor: White
Rxvt*foreground: Wheat
Rxvt*saveLines: 2048
Rxvt*scrollColor: Grey26
Rxvt*scrollBar_right: on
Rxvt*termName: xterm
Rxvt*visualBell: on
! Black
Rxvt*color0: #000000
! Red
Rxvt*color1: Red2
! Green
Rxvt*color2: Green1
! Yellow (brown)
Rxvt*color3: Khaki1
! Blue
Rxvt*color4: DodgerBlue1
! Magenta
Rxvt*color5: DarkOrchid1
! Cyan
Rxvt*color6: Cyan2
! This does not refer to foreground color!
! White
Rxvt*color7: #fdfdfd
! Gray
Rxvt*color8: #666666
! Bright red
!!!Rxvt*color9: #ee0000
Rxvt*color9: OrangeRed
! Bright green
Rxvt*color10: SpringGreen1
! Yellow
Rxvt*color11: Yellow
! Bright blue
Rxvt*color12: DodgerBlue3
! Bright magenta
Rxvt*color13: #ff00ff
! Bright cyan
Rxvt*color14: #00ffff
! This does not refer to foreground color!
! Bright white
Rxvt*color15: #ffffff

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

I use Cygwin's rxvt and an .Xdefaults file to tweak

My cygwin.bat:

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::
@echo off

start /B \cygwin\bin\rxvt.exe -geometry 80x40+325+195 -fn "Andale Mono-13" -sl 2500 -e /bin/bash -i
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::


My Cygwin .Xdefaults:

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! See rxvt --help for items available

! Black
Rxvt*background: #000000
Rxvt*cutchars: `"'()*,;<>[]{|}@
!!!Rxvt*cursorColor: #00ff00
Rxvt*cursorColor: White
Rxvt*foreground: Wheat
Rxvt*saveLines: 2048
Rxvt*scrollColor: Grey26
Rxvt*scrollBar_right: on
Rxvt*termName: xterm
Rxvt*visualBell: on
! Black
Rxvt*color0: #000000
! Red
Rxvt*color1: Red2
! Green
Rxvt*color2: Green1
! Yellow (brown)
Rxvt*color3: Khaki1
! Blue
Rxvt*color4: DodgerBlue1
! Magenta
Rxvt*color5: DarkOrchid1
! Cyan
Rxvt*color6: Cyan2
! This does not refer to foreground color!
! White
Rxvt*color7: #fdfdfd
! Gray
Rxvt*color8: #666666
! Bright red
!!!Rxvt*color9: #ee0000
Rxvt*color9: OrangeRed
! Bright green
Rxvt*color10: SpringGreen1
! Yellow
Rxvt*color11: Yellow
! Bright blue
Rxvt*color12: DodgerBlue3
! Bright magenta
Rxvt*color13: #ff00ff
! Bright cyan
Rxvt*color14: #00ffff
! This does not refer to foreground color!
! Bright white
Rxvt*color15: #ffffff

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
鸠书 2024-07-20 11:34:07

rxvt 很棒,但我也对更改 cygwin 的 bash shell 的颜色感兴趣。
为了更改这些颜色,我编辑了 cygwin\etc\DIR_COLORS
并更改行

# Attribute codes: 
# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
# Text color codes:
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
# Background color codes:
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
EXEC      00;33 
NORMAL    00;37 # global default, although everything should be something.
FILE      00;37 # normal file
DIR       00;32     # directory

并重新配置我的 .bashrc,其中已

eval `dircolors -b /etc/DIR_COLORS`

看到 http://cygwin .com/ml/cygwin/2001-05/msg00938.html
提示颜色也在
/etc/配置文件
例如,在我的登录 .bashrc 中将提示设置为黄色以覆盖 /etc/profile,我可以添加以下行

PS1=('\033[33m$ ')

rxvt is great but I was also interested in changing the colors for cygwin's bash shell.
To change these colors I edited cygwin\etc\DIR_COLORS
and change the lines

# Attribute codes: 
# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
# Text color codes:
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
# Background color codes:
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
EXEC      00;33 
NORMAL    00;37 # global default, although everything should be something.
FILE      00;37 # normal file
DIR       00;32     # directory

and re-sourced my .bashrc which had

eval `dircolors -b /etc/DIR_COLORS`

see http://cygwin.com/ml/cygwin/2001-05/msg00938.html
also the prompt color is in
/etc/profile
for example setting the prompt to yellow in my login .bashrc to override the /etc/profile, I can add the line

PS1=('\033[33m$ ')
静赏你的温柔 2024-07-20 11:34:07

仅供您参考。 Cygwin不是终端(或控制台)应用程序。这类似于回答您正在使用 Windows 来询问您使用什么浏览器上网。 您可以在Windows上使用各种浏览器打开网站,例如ChromeOperaFirefoxMSIE。 类似地,您可以在各种终端中打开 Cygwin 的 shell。 终端是一个应用程序,它管理用户的输入和输出 - 从 Cygwin 的 shell 呈现文本输出并将用户的输入(键盘和鼠标)发​​送回它。 因此字体和颜色设置取决于您使用的终端。

Windows 有许多不同的终端应用程序。 列举其中一些:

  • ConEmu -我肯定会推荐这个,你可以通过多种方式配置它,它有选项卡等。

  • Console2 - 与之前的类似,但选项较少

  • MinTTY - 这个默认情况下随 Cygwin 一起安装,但它非常基本。 您应该在“开始”菜单中以“Cygwin Terminal”名称找到它。

  • Windows 控制台 - 您还可以使用普通 Windows 控制台:执行 cmd.exe,导航到 Cygwin 的根目录并执行 bin/bash.exe -- login -iCygwin.bat

Just for your information. Cygwin is not a terminal (or console) application. It's similar to answer that you're using Windows to question in what browser do you surf the web. You can open website on Windows using various browsers, e.g. Chrome, Opera, Firefox or MSIE. Analogously you can open Cygwin's shell in various terminals. Terminal is an application, which manages input from and output to a user - renders text output from Cygwin's shell and sends user's input (keyboard and mouse) back to it. Therefore font and color settings depend on terminal you use.

There are a lot of various terminal applications for Windows. To name some of them:

  • ConEmu - I would definitely recommend this one, you can configure it in many ways, it has tabs etc.

  • Console2 - similar to the previous with less options

  • MinTTY - this one is installed with Cygwin by default, but it's very basic. You should find it in Start menu under the name "Cygwin Terminal".

  • Windows Console - you can also use plain Windows Console: execute cmd.exe, navigate to Cygwin's root directory and execute bin/bash.exe --login -i or Cygwin.bat

若水般的淡然安静女子 2024-07-20 11:34:07

CygWin 解释颜色的方法(无论是 shell、打印输出、提示...等)应该与任何其他 Linux 相同,但这里的问题来自于 Windows shell,它没有太多的功能。的能力。

好吧,我不知道这是否有帮助,但对我来说这是最好的解决方案,因为我喜欢 Putty 作为终端

  • 从 CygWin 内部安装 OpenSSH (SSHD) 包:< /p>

    apt-cyg 更新
    apt-cyg 安装 sshd
    ssh-主机配置 --> [以管理员身份运行]
    net start sshd

  • 使用 Putty 连接到您的计算机(localhost) :

    putty localhost

现在你应该有一个像样的 shell 能够解释颜色

CygWin method for interpreting colors (whether be it the shell, printouts, prompt... etc) should be the same as any other Linux, but the problem here comes from the Windows shell, that has not much capabilities for that.

Well, I don't know if this could be of help, but for me this is the best solution since I love Putty as terminal:

  • Install OpenSSH (SSHD) package from inside CygWin:

    apt-cyg update
    apt-cyg install sshd
    ssh-host-config --> [Run as admin]
    net start sshd

  • Connect to your computer (localhost) with Putty:

    putty localhost

Now you should have a decent shell capable of interpreting colors.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文