如何使Emacs终端颜色与Emacs GUI颜色相同? [英] How to make Emacs terminal colors the same as Emacs GUI colors?

查看:464
本文介绍了如何使Emacs终端颜色与Emacs GUI颜色相同?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Ubuntu(Hardy Heron)的Emacs程序,我喜欢Emacs GUI中的默认文本着色。但是,当Emacs在终端中运行时,默认的文本颜色是不同的,并且是非常丰富的。

I program with Emacs on Ubuntu (Hardy Heron at the moment), and I like the default text coloration in the Emacs GUI. However, the default text coloration when Emacs is run in the terminal is different and garish.

如何使终端中的颜色与GUI中的颜色匹配? / p>

How do I make the colors in the terminal match the colors in the GUI?

推荐答案

您不必拘泥于终端的默认16(或更少)颜色。现代终端将支持256种颜色(这将让你非常接近你的GUI外观)。

You don't have to be stuck to your terminal's default 16 (or fewer) colours. Modern terminals will support 256 colours (which will get you pretty close to your GUI look).

不幸的是,让终端支持256色是棘手的部分,从术语到术语。 此页面帮助了我很多(但它是过时的;我已经在gnome-terminal和xfce4-terminal中使用了256种颜色;但是您可能需要从源代码中构建它们。)

Unfortunately, getting your terminal to support 256 colours is the tricky part, and varies from term to term. This page helped me out a lot (but it is out of date; I've definitely gotten 256 colours working in gnome-terminal and xfce4-terminal; but you may have to build them from source.)

一旦你的终端愉快地使用256种颜色,魔术调用在你调用emacs之前将终端类型设置为xterm-256color,例如:

Once you've got your terminal happily using 256 colours, the magic invocation is setting your terminal type to "xterm-256color" before you invoke emacs, e.g.:

env TERM=xterm-256color emacs -nw

可以在 .bashrc 文件中设置TERM:

Or, you can set TERM in your .bashrc file:

export TERM=xterm-256color

您可以通过执行

You can check if it's worked in emacs by doing M-x list-colors-display, which will show you either 16, or all 256 glorious colours.

如果它工作,那么看看<$ c $

If it works, then look at color-theme like someone else suggested.

(你可能会在某个时候感到沮丧;上帝知道我每次都做尝试做类似的事情。但坚持下去;这是值得的。)

(You'll probably get frustrated at some point; god knows I do every time I try to do something similar. But stick with it; it's worth it.)

这篇关于如何使Emacs终端颜色与Emacs GUI颜色相同?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆